]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added event handlers to logout action
authorZach Copley <zach@controlyourself.ca>
Fri, 15 May 2009 21:41:41 +0000 (21:41 +0000)
committerZach Copley <zach@controlyourself.ca>
Fri, 15 May 2009 21:41:41 +0000 (21:41 +0000)
EVENTS.txt
actions/logout.php

index 5edf59245a5595710497350ad7d2c913cc4481bb..d689f0be63235ce987d4731dbf6374d0e239af6d 100644 (file)
@@ -103,3 +103,9 @@ EndPublicGroupNav: At the end of the public group nav menu
 RouterInitialized: After the router instance has been initialized
 - $m: the Net_URL_Mapper that has just been set up
 
+StartLogout: Before logging out
+- $action: the logout action
+
+EndLogout: After logging out
+- $action: the logout action
+
index 9f3bfe2470a2253d0e93acd9ca3ec2bf976c5423..c34b10987a76985e08c15ad8adc8ac8f5a3211bb 100644 (file)
@@ -70,10 +70,20 @@ class LogoutAction extends Action
         if (!common_logged_in()) {
             $this->clientError(_('Not logged in.'));
         } else {
-            common_set_user(null);
-            common_real_login(false); // not logged in
-            common_forgetme(); // don't log back in!
+            if (Event::handle('StartLogout', array($this))) {
+                $this->logout();
+            }
+            Event::handle('EndLogout', array($this));
+
             common_redirect(common_local_url('public'), 303);
         }
     }
+
+    function logout()
+    {
+        common_set_user(null);
+        common_real_login(false); // not logged in
+        common_forgetme(); // don't log back in!
+    }
+
 }