summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-05-15 21:41:41 +0000
committerZach Copley <zach@controlyourself.ca>2009-05-15 21:41:41 +0000
commit41f6c9d8cfe467293a1847f403225c338f15ab4f (patch)
tree9c680d594b60afd2c8cf751de1eb9c9841411702
parent6a2d22ddd83b1b914e2f5559f93d08b0d5f92242 (diff)
Added event handlers to logout action
-rw-r--r--EVENTS.txt6
-rw-r--r--actions/logout.php16
2 files changed, 19 insertions, 3 deletions
diff --git a/EVENTS.txt b/EVENTS.txt
index 5edf59245..d689f0be6 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -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
+
diff --git a/actions/logout.php b/actions/logout.php
index 9f3bfe247..c34b10987 100644
--- a/actions/logout.php
+++ b/actions/logout.php
@@ -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!
+ }
+
}