{"action":"created","issue":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/5603","repository_url":"https://api.github.com/repos/joomla/joomla-cms","labels_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5603/labels{/name}","comments_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5603/comments","events_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5603/events","html_url":"https://github.com/joomla/joomla-cms/pull/5603","id":53308883,"number":5603,"title":"[fix] #4497, Proposal use exceptions in plugin method onUserLogout","user":{"login":"jackkum","id":2418167,"avatar_url":"https://avatars.githubusercontent.com/u/2418167?v=3","gravatar_id":"","url":"https://api.github.com/users/jackkum","html_url":"https://github.com/jackkum","followers_url":"https://api.github.com/users/jackkum/followers","following_url":"https://api.github.com/users/jackkum/following{/other_user}","gists_url":"https://api.github.com/users/jackkum/gists{/gist_id}","starred_url":"https://api.github.com/users/jackkum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackkum/subscriptions","organizations_url":"https://api.github.com/users/jackkum/orgs","repos_url":"https://api.github.com/users/jackkum/repos","events_url":"https://api.github.com/users/jackkum/events{/privacy}","received_events_url":"https://api.github.com/users/jackkum/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/joomla/joomla-cms/labels/PR-staging","name":"PR-staging","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-01-03T16:50:51Z","updated_at":"2016-05-11T05:55:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/joomla/joomla-cms/pulls/5603","html_url":"https://github.com/joomla/joomla-cms/pull/5603","diff_url":"https://github.com/joomla/joomla-cms/pull/5603.diff","patch_url":"https://github.com/joomla/joomla-cms/pull/5603.patch"},"body":"Need sort plugins, plg_user_joomla must be last.\r\n\r\n```php\r\nclass PlgUserLogout extends JPlugin\r\n{\r\n\tpublic function onUserLogout($user, $options = array())\r\n\t{\r\n            throw new Exception(\"You shall not pass!\");\r\n\t}\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/joomla/joomla-cms/issues/comments/218368648","html_url":"https://github.com/joomla/joomla-cms/pull/5603#issuecomment-218368648","issue_url":"https://api.github.com/repos/joomla/joomla-cms/issues/5603","id":218368648,"user":{"login":"jackkum","id":2418167,"avatar_url":"https://avatars.githubusercontent.com/u/2418167?v=3","gravatar_id":"","url":"https://api.github.com/users/jackkum","html_url":"https://github.com/jackkum","followers_url":"https://api.github.com/users/jackkum/followers","following_url":"https://api.github.com/users/jackkum/following{/other_user}","gists_url":"https://api.github.com/users/jackkum/gists{/gist_id}","starred_url":"https://api.github.com/users/jackkum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackkum/subscriptions","organizations_url":"https://api.github.com/users/jackkum/orgs","repos_url":"https://api.github.com/users/jackkum/repos","events_url":"https://api.github.com/users/jackkum/events{/privacy}","received_events_url":"https://api.github.com/users/jackkum/received_events","type":"User","site_admin":false},"created_at":"2016-05-11T05:55:34Z","updated_at":"2016-05-11T05:55:34Z","body":"@wilsonge \r\nif i understand you correctly, i have to do something like this:\r\n```php\r\n\r\n// OK, the credentials are built. Lets fire the onLogout event.\r\ntry\r\n{\r\n  $results = $this->triggerEvent('onUserLogout', array($parameters, $options));\r\n}\r\ncatch (Exception $e)\r\n{\r\n  $this->enqueueMessage($e->getMessage());\r\n  \r\n}\r\n\r\n// Check if any of the plugins failed. If none did, success.\r\ntry \r\n{\r\n  if (isset($results) && is_array($results) && !in_array(false, $results, true))\r\n  {\r\n    $options['username'] = $user->get('username');\r\n    $this->triggerEvent('onUserAfterLogout', array($options));\r\n\r\n    return true;\r\n  }\r\n}\r\ncatch(Exception $e)\r\n{\r\n  $this->enqueueMessage($e->getMessage());\r\n}\r\n\r\n// Trigger onUserLoginFailure Event.\r\n$this->triggerEvent('onUserLogoutFailure', array($parameters));\r\n```"}}