{"action":"created","issue":{"url":"https://api.github.com/repos/cannod/moodle-drupalservices/issues/46","labels_url":"https://api.github.com/repos/cannod/moodle-drupalservices/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/cannod/moodle-drupalservices/issues/46/comments","events_url":"https://api.github.com/repos/cannod/moodle-drupalservices/issues/46/events","html_url":"https://github.com/cannod/moodle-drupalservices/issues/46","id":53354091,"number":46,"title":"Logging out of Moodle or Drupal does not log out the other one.","user":{"login":"Cheesenbizkitz","id":10188313,"avatar_url":"https://avatars.githubusercontent.com/u/10188313?v=3","gravatar_id":"","url":"https://api.github.com/users/Cheesenbizkitz","html_url":"https://github.com/Cheesenbizkitz","followers_url":"https://api.github.com/users/Cheesenbizkitz/followers","following_url":"https://api.github.com/users/Cheesenbizkitz/following{/other_user}","gists_url":"https://api.github.com/users/Cheesenbizkitz/gists{/gist_id}","starred_url":"https://api.github.com/users/Cheesenbizkitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cheesenbizkitz/subscriptions","organizations_url":"https://api.github.com/users/Cheesenbizkitz/orgs","repos_url":"https://api.github.com/users/Cheesenbizkitz/repos","events_url":"https://api.github.com/users/Cheesenbizkitz/events{/privacy}","received_events_url":"https://api.github.com/users/Cheesenbizkitz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cannod/moodle-drupalservices/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/cannod/moodle-drupalservices/milestones/2","labels_url":"https://api.github.com/repos/cannod/moodle-drupalservices/milestones/2/labels","id":626924,"number":2,"title":"2.0 release","description":null,"creator":{"login":"netw3rker","id":1148350,"avatar_url":"https://avatars.githubusercontent.com/u/1148350?v=3","gravatar_id":"","url":"https://api.github.com/users/netw3rker","html_url":"https://github.com/netw3rker","followers_url":"https://api.github.com/users/netw3rker/followers","following_url":"https://api.github.com/users/netw3rker/following{/other_user}","gists_url":"https://api.github.com/users/netw3rker/gists{/gist_id}","starred_url":"https://api.github.com/users/netw3rker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netw3rker/subscriptions","organizations_url":"https://api.github.com/users/netw3rker/orgs","repos_url":"https://api.github.com/users/netw3rker/repos","events_url":"https://api.github.com/users/netw3rker/events{/privacy}","received_events_url":"https://api.github.com/users/netw3rker/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":2,"state":"open","created_at":"2014-04-11T04:49:41Z","updated_at":"2015-01-06T19:26:09Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-01-05T00:12:56Z","updated_at":"2015-01-06T22:09:38Z","closed_at":null,"body":"Using the 2.x-2.x-fix_url_redirect branch, I'm having an issue where logging out of Moodle will not log out the user on the Drupal site, this results in Moodle doing what it does by default, logging out the user and sending them to the home page of Moodle, but because they are still logged in on Drupal it logs them back in to Moodle, so the user gets stuck in a loop where they hit logout, the page refreshes a couple of times and then they are still logged in.\r\n\r\nAlso logging out of Drupal doesn't log out the user on Moodle, so this means that if I'm using the Drupal site as the main log in and log out portal, if there are multiple users on one computer, one user will log out on Drupal, but wouldn't get logged out in Moodle, then the next user would log in to Drupal, go to Moodle, but still be logged in as the previous user in Moodle.\r\n\r\nI was going to just put in my own workarounds around this, but if the plugin can do it more elegantly, that'd be great.\r\n\r\nI was going to edit the section of code in Moodle's /login/logout.php file line 35-40:\r\n\r\n```PHP\r\n// can be overridden by auth plugins\r\nif ($login) {\r\n    $redirect = get_login_url();\r\n} else {\r\n    $redirect = $CFG->wwwroot.'/';\r\n}\r\n```\r\n\r\nTo something like this so that it would go straight to the Drupal logout once the user is logged out in Moodle:\r\n\r\n```PHP\r\n// can be overridden by auth plugins\r\nif ($login) {\r\n    $redirect = get_login_url();\r\n} else {\r\n    $redirect = 'http://dev.example.com/user/logout';\r\n}\r\n```\r\n\r\nBut by the looks of the comment there, the auth plugin should be able to do this without me needing to hardcode it in.\r\n"},"comment":{"url":"https://api.github.com/repos/cannod/moodle-drupalservices/issues/comments/68943317","html_url":"https://github.com/cannod/moodle-drupalservices/issues/46#issuecomment-68943317","issue_url":"https://api.github.com/repos/cannod/moodle-drupalservices/issues/46","id":68943317,"user":{"login":"netw3rker","id":1148350,"avatar_url":"https://avatars.githubusercontent.com/u/1148350?v=3","gravatar_id":"","url":"https://api.github.com/users/netw3rker","html_url":"https://github.com/netw3rker","followers_url":"https://api.github.com/users/netw3rker/followers","following_url":"https://api.github.com/users/netw3rker/following{/other_user}","gists_url":"https://api.github.com/users/netw3rker/gists{/gist_id}","starred_url":"https://api.github.com/users/netw3rker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netw3rker/subscriptions","organizations_url":"https://api.github.com/users/netw3rker/orgs","repos_url":"https://api.github.com/users/netw3rker/repos","events_url":"https://api.github.com/users/netw3rker/events{/privacy}","received_events_url":"https://api.github.com/users/netw3rker/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T22:09:38Z","updated_at":"2015-01-06T22:09:38Z","body":"Also, I updated the Drupal - moodle_sso module to be able to log users out of moodle if they log out from the drupal side of things. If you update that module and configure it, you'll be able to make that happen as well."}}