Reputation: 9465
I wanted to do some custom functionality upon user logout, so I hooked to the customer logout event, and added an observer to it.
Here's the configuration in config.xml
<customer_logout>
<observers>
<cwmyaccount>
<type>singleton</type>
<class>KrtMalta_Myaccount_Model_Observer</class>
<method>setRegularCustomer</method>
</cwmyaccount>
</observers>
</customer_logout>
However I'd like the execute my custom functionality even on session-timeout. I've looked up google and Magento files with pretty much no success. Is it possible to hook to session-timeout somehow?
Upvotes: 2
Views: 1813
Reputation: 69967
Sessions are cleaned up automatically by PHP when a session is started and there is currently no way to hook into this process unless you write your own custom session handler.
If you write your own handler, then PHP will call your gc
method giving you control over the old session data that gets destroyed. Keep in mind that this happens at the start of the request (when session_start() is called) so you would want whatever processing you do to happen very quickly as not to delay the request being processed.
Upvotes: 2