there has been a request for a feature to allow custom handling of the logout function, in order to perform certain actions related to custom functionality, like cleaning up session variables used in custom modules.
here are 2 rough suggestions for implementation:
1. We could allow custom logout handlers to hook in to the systems' logout function.
multiple custom modules may require their own logout handler to clear module-specific data/variables. we would then allow multiple logout handlers to be hooked in, and executed sequentially.
2. We could put all custom module session variables in to a session array that the built-on logout function would unset() when executed.
unset( ($_SESSION['privateVars']['myVar'] );
other session variables would be left untouched.