BUGFIX: Better generation of PastMember cookie when you have stale login info

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66888 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-11-28 01:10:41 +00:00
parent 89276d7852
commit 331a427796

View File

@ -82,9 +82,10 @@ class Controller extends RequestHandler {
// Directly access the session variable just in case the Group or Member tables don't yet exist // Directly access the session variable just in case the Group or Member tables don't yet exist
if(Session::get('loggedInAs') && Security::database_is_ready()) { if(Session::get('loggedInAs') && Security::database_is_ready()) {
$member = Member::currentUser(); if($member = Member::currentUser()) {
Cookie::set("PastMember", true); Cookie::set("PastMember", true);
DB::query("UPDATE Member SET LastVisited = NOW() WHERE ID = $member->ID", null); DB::query("UPDATE Member SET LastVisited = NOW() WHERE ID = $member->ID", null);
}
} }
// This is used to test that subordinate controllers are actually calling parent::init() - a common bug // This is used to test that subordinate controllers are actually calling parent::init() - a common bug