Signin/out button


we are using OJS 2.x and i made a plugin which changes the layout of the webiste to
our needs. I also added now an “lougout” button, but I only want to display it if
a user is logged in otherwise there should be a login button.

Is there a posibility to this with javascript. Which elements can i check?


Best regards,

If you have made an OJS plugin, you have access to the full PHP framework. Is there a reason you want to perform the check in Javascript instead of simply using a PHP call?

No there is no need for me to use JavaScript i can also do it with PHP, is the PHP framework documented?

The version 2.4.8’s API documentation (via doxygen) is available here:
The function you want is:

For an example in PHP of checking whether a user is logged in, see:

which drives the template conditional here:

Okay, thanks for your answer. Is there a method to check if i am logged in my alternate header too?
There i can’t use PHP i have only the possibility use javascript and i want to place a login button in header.

Thanks in advance.

If your alternate header is using the PKPTemplateManager for display (it probably is), the Smarty variable $isUserLoggedIn will be available to you.

I receive an “Uncaught ReferenceError: $isUserLoggedIn is not defined”, if I use this variable. How can i check if my header is using this PKPTTemplateManger.

Typically, some code will instanciate a PKPTemplateManager:

Then display a particular template using the PKPTemplateManager object:

This template will include other templates, (for example, a common header):

Can you share you code to show how your header is being referenced?