An on user logout event would be great.
Permalink
It would be nice to have an event for user logout. I have an add-on that creates some cookies and it would be nice to kill these cookies through an event when the user logs out.
![Mnkras](/files/avatars/781.jpg)
It wouldn't be consistent, if the user leaves the site, and they never hit logout, then its not fired.
Depends on what you are trying to accomplish. In my case I don't want cookies destroyed if the user leaves the site and goes somewhere else. I want cookies destroyed specifically when the user logs out.
The cookie example aside there are many cases where this type of functionality would come in handy. A user logout hook is common with CMS APIs.
The cookie example aside there are many cases where this type of functionality would come in handy. A user logout hook is common with CMS APIs.
It's built into the logout function in 5.5.2 (and probably earlier).
You need to look for event 'on_user_logout'
and you can reference it in /concrete/models/user.php line 245
You need to look for event 'on_user_logout'
and you can reference it in /concrete/models/user.php line 245
function logout() { // First, we check to see if we have any collection in edit mode $this->unloadCollectionEdit(); @session_unset(); @session_destroy(); Events::fire('on_user_logout'); if ($_COOKIE['ccmUserHash']) { setcookie("ccmUserHash", "", 315532800, DIR_REL . '/'); } }