1

I want to give users a custom logout message based on their role, but on logout the $user variable is no longer available.

How can I achieve this? I figured the key might be with $_SESSION, during login, but I am not sure exactly how to store user role in the session.

2
  • 4
    There are a couple of gotchas in this; you do have the account object, with the roles, in hook_user_logout, but if you set a message it'll perish along with the session when logout completes. Fortunately it's a simple workaround: api.drupal.org/comment/43698#comment-43698
    – Clive
    Commented Dec 9, 2016 at 4:56
  • Another reason to love cookies
    – No Sssweat
    Commented Dec 9, 2016 at 10:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.