You are viewing the PKP Support Forum | PKP Home Wiki

Header Modification

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Header Modification

Postby cjpetrov » Mon Jun 23, 2014 1:58 am

I have a problem with the following code:
Code: Select all
{if $userSession->getSessionVar('signedInAs')}
   <a href="{url page="login" op="signOutAsUser"}"><span>Log out as user</span></a>

It's part from the user plugin. My goal is to insert this if statement in the header, but when I do this i have this error message:


So I've looked in the t_compile file for header.tpl.php, but I can't figure it out.

Thanks in advance,
Tsvetan Petrov,
Medical University of Varna, Bulgaria
Posts: 22
Joined: Tue Apr 15, 2014 9:50 am
Location: Varna, Bulgaria

Re: Header Modification

Postby asmecher » Mon Jun 23, 2014 8:50 am

Hi Tsvetan,

You're getting that error message because the userSession variable hasn't been assigned to the template manager at the time the header template output is generated. Have a look at the controller for the sidebar block code you've used as an example (plugins/blocks/user/UserBlockPlugin.inc.php) and you'll see...
Code: Select all
$session =& Request::getSession();
$templateMgr->assign_by_ref('userSession', $session);
To use the userSession variable in the header template, you'll need to make a similar assignment. I think classes/template/TemplateManager.inc.php would probably be a logical place.

Alec Smecher
Public Knowledge Project Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 3 guests