Access Lemonstand's backend login details written by Simon Stevens on 24 July, 2012

I wanted to access the user session for the backend to use in the frontend so that I could give administrators rights to things that only subscribed members would normally be able to access.

Took a bit of digging, but here it is:

$phpr = new Phpr_Security();
$phpr->userClassName = 'Users_User';
$admin = $phpr->getUser();

By default, the Phpr_Security class uses the Phpr_User model, which isn't as fully featured as the Users_User model.  Fortunately Lemonstand added a way of changing the model that's used, so the following line is used to force it to use Users_User, which then allows us access to methods such as is_administrator();

$phpr->userClassName = 'Users_User';

Simon Stevens Google+ More Posts

Simon is the resident web developer and co-owner of 3DPixel Ltd. formed March 2003.

Having joined 3DPixel Ltd. in February 2006, Simon adds considerable expertise in client side and server side scripting.

Be the first to Comment