OJS OCS OMP OHS

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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

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
require('includes/driver.inc.php');
initSystem();
$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?
osborne
 
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() . '/');
to
Code: Select all
ini_set('session.cookie_path', '/');
Regards,
Alec Smecher
Open Journal Systems Team
asmecher
 
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.
osborne
 
Posts: 77
Joined: Mon Jun 07, 2004 1:24 pm
Location: Toronto, Canada


Return to OJS Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest