API/Authentication

From aMember Pro Documentation
Revision as of 07:49, 28 June 2011 by Alex (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There are 2 classes available to handle user and admin authentication: Am_Auth_User and Am_Auth_Admin Usage is the same:

Am_Auth_User::getInstance()->getUser(); // returns User object or null
Am_Auth_User::getInstance()->getUserId() // returns user_id or null
$result = Am_Auth_User::getInstance()->login('login', 'password', '11.22.33.44');
echo $result->isValid() ? "OK" : ("failed: " . $result->getMessage());
 
Am_Auth_User::getInstance()->logout();