Source of file LivePubMember.php
Size: 1,302 Bytes - Last Modified: 2021-12-23T10:03:27+00:00
/var/www/docs.ssmods.com/process/src/code/LivePubMember.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 | <?php /** * Stores a little extra info about the user in the session so it * can be used by cached pages. * * @author Mark Guinn <mark@adaircreative.com> * @date 05.28.2014 * @package shop_livepub */ class LivePubMember extends DataExtension { /** * This is a hook that's called whenever a new user logs in. * This session variable is used in connection with livepub */ public function memberLoggedIn() { Session::set('IsCmsAdmin', Permission::check('CMS_ACCESS_CMSMain')); Session::set('LoggedInMember', $this->dataForSession()); } public function memberAutoLoggedIn() { Session::set('IsCmsAdmin', Permission::check('CMS_ACCESS_CMSMain')); Session::set('LoggedInMember', $this->dataForSession()); } public function memberLoggedOut() { Session::clear('IsCmsAdmin'); Session::clear('LoggedInMember'); } /** * @return array */ protected function dataForSession() { return array( 'ID' => $this->owner->ID, 'Groups' => $this->owner->Groups()->column('Code'), 'Email' => $this->owner->Email, 'FirstName' => $this->owner->FirstName, 'Surname' => $this->owner->Surname, ); } } |