You are viewing the PKP Support Forum | PKP Home Wiki

Detecting that user is logged in

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.

Detecting that user is logged in

Postby osborne » Thu Mar 02, 2006 8:38 pm

When put in a file in my ojs directory, the following code detects whether a user is logged in:
Code: Select all
$isUserLoggedIn = Validation::isLoggedIn();

So far, so good. But I'd like a file outside the ojs directory to be able to detect whether a user is logged in; I can't find a way of doing so. I'm guessing that it's either trivial or impossible (and that if I understood how the PHP session system worked I'd know the answer!). Is it possible?
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Postby asmecher » Fri Mar 03, 2006 10:37 am

Hi Martin,

In addition to bringing in the required PHP includes, you'll need to modify the OJS cookie's base path -- see classes/session/SessionManager.inc.php, line 40. To make the cookie server-wide, change:
Code: Select all
ini_set('session.cookie_path', Request::getBasePath() . '/');
Code: Select all
ini_set('session.cookie_path', '/');
Alec Smecher
Open Journal Systems Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Postby osborne » Fri Mar 03, 2006 8:58 pm

Many thanks---it was really bugging me that I couldn't figure out how to do it.
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest