Body: <p>In my plugin I have an <code>init()</code> method:</p>
  
  <pre><code>public function init ()
  {
      parent::init();
  
      require CRAFT_PLUGINS_PATH.'/myplugin/vendor/autoload.php';
  
      $this-&gt;callTemplateHooks();
  
      craft()-&gt;onError = function(Event $event) {
          $this-&gt;logError($event);
      };
  
      craft()-&gt;on('userSession.onLogout', function(Event $event) {
          // do something
      });
  }
  </code></pre>
  
  <p>I've got a breakpoint set on the <code>onLogout()</code> method of the <code>UserService</code> class so I can see that firing, however the breakpoint on my <code>// do something</code> line never gets hit.</p>
  
  <p>Am I missing something here?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-25T03:03:07.103Z
Comments.Text: Syntax looks okay. This isn't a console request, is it? What happens if you remove everything except the `craft()->on('userSession.onLogout'` bit?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-03-25T09:13:48.613Z
Comments.Text: @BradBell it IS firing when you hit the logout route, I was also expecting it to fire when the user session timed out, which it doesn't. I'm trying to store some additional data in session so I was trying to clear httpSession when the user session expired but I can see that instead I can use `craft()->userSession->setState()` and `craft()->userSession->getState()`. From what I can see anything set that way will be cleared from session when the user's session expires.
Comments.UserDisplayName: Russ Back
Tags: <plugin-development><users><events><session>
Title: Plugin event listener not firing
ThreadText: # Plugin event listener not firing
  
  (Asked by: username_0 on 2016-03-24)
  
  In my plugin I have an `init()` method:
  
  ```
  public function init ()
  {
      parent::init();
  
      require CRAFT_PLUGINS_PATH.'/myplugin/vendor/autoload.php';
  
      $this->callTemplateHooks();
  
      craft()->onError = function(Event $event) {
          $this->logError($event);
      };
  
      craft()->on('userSession.onLogout', function(Event $event) {
          // do something
      });
  }
  
  ```
  
  I've got a breakpoint set on the `onLogout()` method of the `UserService` class so I can see that firing, however the breakpoint on my `// do something` line never gets hit.
  
  Am I missing something here?
  
  **Tags:** plugin-development, users, events, session
  
  > **Comments:**
  > **username_1**: Syntax looks okay. This isn't a console request, is it? What happens if you remove everything except the `craft()->on('userSession.onLogout'` bit?  
  > **username_0**: @username_1 it IS firing when you hit the logout route, I was also expecting it to fire when the user session timed out, which it doesn't. I'm trying to store some additional data in session so I was trying to clear httpSession when the user session expired but I can see that instead I can use `craft()->userSession->setState()` and `craft()->userSession->getState()`. From what I can see anything set that way will be cleared from session when the user's session expires.  
  
  ---
  
  ## 0 answers
  
  