jimlongo Posted August 10, 2018 Share Posted August 10, 2018 I'm trying to write a hook that will either display a success message or a form depending on some php logic. So far I have a hook, that in real simple terms is like this add_hook('AdminAreaPage', 1, function ($vars){ $extraVariables = []; $are_we_connected = true; // sparing you our custom code, but this could be false if ($are_we_connected) { $extraVariables['isConnected'] = true; }else{ $extraVariables['isConnected'] = false; } return $extraVariables; }); Then in the template file I have {if $isConnected} show the success message {else} show the form {/if} Seems to me this should display the success message, but it continues to show the form. If I do something like this the page displays the correct message, {if 1==1} show the success message {else} the form {/if} so I'm assuming i'm not using the $extraVariables[] properly. Any hints would be appreciated, TIA. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.