We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Is the anyway to show guests content with a simple {if} statement? | Forum

Dean L
Dean L Jan 9 '13
Hi is there anyway I can show people who are not logged in certain content?

Maybe like this:
<?php if($condition):?><ahref="http://google.com">This will only display if $condition is true</a><?php endif;?>

I don't understand the authentication process of Oxwall, although I have been trying to learn but it is waaaay over my head.

Any advice appreciated :-)

Purusothaman Ramanujam
Do you need the function to check if an user is logged in or not? If so the function is

Dean L
Dean L Jan 9 '13
Hi Purusothaman,

Cheers for your quick answer.

Yeah kind of. I'm not too sure how you program a new function though that's my problem. I was hoping that maybe a html/php combo could check just to see if a session was active or not to show content.

For example: You're a visitor to the site you see this - Visitor content.
                  You're logged in to the site you see this - Member content.

I know the site does this already with things such as the sidebar etc, I just don't understand how.
The Forum post is edited by Dean L Jan 9 '13
Michael I.
Michael I. Jan 10 '13
Dean, use OW::getUser()->isAuthenticated() as your if statement, it returns a boolean value.
Dean L
Dean L Jan 11 '13
Brilliant, I understand now... It works, thank you!
Jason Apr 25 '15
can OW::getUser()->isAuthenticated() be used in an html template file? how ? 

I was hoping to do what Dean wants to do. 

dave Leader
dave Apr 25 '15
you cant use that in an html you have to assign a var to smarty first then you can use the var in the html file. 
dave Leader
dave Apr 25 '15
so like this 

in the php file you would do this 

even though it returns a boolen (t or f) falue i still like to assign it anyway.. just how i do it. 

if (OW::getUser()->isAuthenticated() )


   $memberonline = true;


          $memberonliine = false;

        }//close if else 


and then in your html you can use 


 or include in if statement or whatever