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

how to test if user is logged in? | Forum

Martin Philipps
Martin Philipps Aug 10 '14
Hello,


I have a plugin that changes directly the layout/template. If the plugin is activated its visible to EVERYBODY.

I would want to have it shown only to logged in users. Well, with a widget that's easily done, but this plugin does not use widgets, it changes the template directly. How can I add a simple quesry or test wether the user is logged in or just a guest - to decide if the change is shown or not?


Thank you for your help

Alia Team
Alia Aug 11 '14
Standard method is ( of course you will need to adjust it to show what you need in case if user is loged in):

if ( !OW::getUser()->isAuthenticated() )
{
throw new AuthenticateException();
}
Martin Philipps
Martin Philipps Aug 11 '14
ok, that's great, thank you! it works fine :)
The Forum post is edited by Martin Philipps Aug 11 '14