turner2f Posted February 22, 2017 Report Posted February 22, 2017 I am looking for a way to make a button, link or some word content appear when a visitor is NOT logged in ( or disappear when they ARE logged in ). I tried using the following PHP statements... <?php if ($this->Html->ifSet($logged_in)) { ?> <br/><strong>Already a member? </strong>Please <a href="http://linkurlhere"><u>login</u></a> . <br/><br/> <?php } ?> ALSO TRIED.. <?php if ($this->Html->ifSet($client)) { ?> <br/><strong>Already a member? </strong>Please <a href="http://linkurlhere"><u>login</u></a> . <br/><br/> <?php } ?> Any suggestion please ? Quote
0 Tyson Posted February 23, 2017 Report Posted February 23, 2017 $logged_in is set by AppController, so any page that extends AppController and uses ::preAction will have it defined. Your example using it, however, employs opposite logic for displaying the link. if (!$this->Html->ifSet($logged_in)) { ...user is not logged in... } Michael 1 Quote
0 turner2f Posted February 27, 2017 Author Report Posted February 27, 2017 Thanks. I am not a PHP coder, and I have tried many times and failed to accomplish what I am needing to do. I need your help. Can you please supply me with the complete PHP statement that will make content disappear when logged in ? Quote
0 Blesta Addons Posted March 1, 2017 Report Posted March 1, 2017 <?php if (!$this->Html->ifSet($logged_in)) { ?> <br/><strong>Already a member? </strong>Please <a href="http://linkurlhere"><u>login</u></a> . <br/><br/> <?php } ?> Quote
0 turner2f Posted March 1, 2017 Author Report Posted March 1, 2017 Hello Besta Addons, Thanks for the reply. Earlier I used and posted this same PHP statement in this post and it did not work . Did this PHP statement work for you ? Quote
0 Blesta Addons Posted March 1, 2017 Report Posted March 1, 2017 29 minutes ago, turner2f said: Hello Besta Addons, Thanks for the reply. Earlier I used and posted this same PHP statement in this post and it did not work . Did this PHP statement work for you ? no is not the same , your statement for logged in user, @Tyson statement for NON logged in users . activa 1 Quote
Question
turner2f
I am looking for a way to make a button, link or some word content appear when a visitor is NOT logged in ( or disappear when they ARE logged in ).
I tried using the following PHP statements...
ALSO TRIED..
Any suggestion please ?
5 answers to this question
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.