Take the 2-minute tour ×

I created my own Session Manager class I only overrode one method which is the destroy($id) method. I wrote there this:

public function destroy($id)
    $result = parent::destroy($id);
    $model = new Model_User();
    return $result;

the logoutUser(); method deletes the logged in user from the logged_users table because everytime a user logs in i write their session id and userid in the logged_users table. But apparently the method is not being called cause everytime I check the table the user is not logged out. What could be the problem?

share|improve this question
How are you telling the app to use your custom SessionManager class? –  David Weinraub Mar 5 '12 at 8:48
add comment

1 Answer

Your code snippet seems to be okay, so I'm guessing the problem occurs somewhere later, probably in Model_User::logoutUser() or when trying to INSERT/UPDATE/DELETE in your logged_users-table. Try echo and die($variable) in your code blocks, to see if they are executed and that variables are set as expected (e.g. check in your Model_User if logoutUser() is called and $id was actually passed). Even better, take your time and learn basic unit-testing. ;)

Side-note: There seems to be some duplication in your code, as your Model_User should not perform an action like logout(). Take a look at Zend_Session_SaveHandler_DbTable, if you want to have session states in a table. Having some kind of session handler AND the user_model maintain a logged_users-table seems unnecessary.

share|improve this answer
add comment

Your Answer


