{"action":"created","issue":{"url":"https://api.github.com/repos/modxcms/revolution/issues/11883","labels_url":"https://api.github.com/repos/modxcms/revolution/issues/11883/labels{/name}","comments_url":"https://api.github.com/repos/modxcms/revolution/issues/11883/comments","events_url":"https://api.github.com/repos/modxcms/revolution/issues/11883/events","html_url":"https://github.com/modxcms/revolution/issues/11883","id":39771149,"number":11883,"title":"moduser.class.php: Can't programmatically add user to a user group without assigning a role ","user":{"login":"gadgetto","id":876737,"avatar_url":"https://avatars.githubusercontent.com/u/876737?v=3","gravatar_id":"","url":"https://api.github.com/users/gadgetto","html_url":"https://github.com/gadgetto","followers_url":"https://api.github.com/users/gadgetto/followers","following_url":"https://api.github.com/users/gadgetto/following{/other_user}","gists_url":"https://api.github.com/users/gadgetto/gists{/gist_id}","starred_url":"https://api.github.com/users/gadgetto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gadgetto/subscriptions","organizations_url":"https://api.github.com/users/gadgetto/orgs","repos_url":"https://api.github.com/users/gadgetto/repos","events_url":"https://api.github.com/users/gadgetto/events{/privacy}","received_events_url":"https://api.github.com/users/gadgetto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-08-07T21:38:16Z","updated_at":"2015-08-12T11:58:01Z","closed_at":null,"body":"With the current `joinGroup` method of the `moduser.class.php` its not possible to programmatically add a user to a group without assigning a role. Because if you pass 0 as role value the role field in `modx_member_groups` table will always be set to the fields default value 1.\r\n\r\nBoth of the following method calls will lead to a role 1 (= Member):\r\n\r\n```\r\n$user->joinGroup(intval($group), 0);\r\n$user->joinGroup(intval($group));\r\n```\r\n\r\nThe problem lies here:\r\n\r\nhttps://github.com/modxcms/revolution/blob/master/core/model/modx/moduser.class.php#L668\r\n\r\nand here:\r\n\r\nhttps://github.com/modxcms/revolution/blob/master/core/model/modx/moduser.class.php#L688\r\n\r\nIts only possible to set the role to 0=NONE in the manager while editing a users access permissions. "},"comment":{"url":"https://api.github.com/repos/modxcms/revolution/issues/comments/130272407","html_url":"https://github.com/modxcms/revolution/issues/11883#issuecomment-130272407","issue_url":"https://api.github.com/repos/modxcms/revolution/issues/11883","id":130272407,"user":{"login":"OptimusCrime","id":2326278,"avatar_url":"https://avatars.githubusercontent.com/u/2326278?v=3","gravatar_id":"","url":"https://api.github.com/users/OptimusCrime","html_url":"https://github.com/OptimusCrime","followers_url":"https://api.github.com/users/OptimusCrime/followers","following_url":"https://api.github.com/users/OptimusCrime/following{/other_user}","gists_url":"https://api.github.com/users/OptimusCrime/gists{/gist_id}","starred_url":"https://api.github.com/users/OptimusCrime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OptimusCrime/subscriptions","organizations_url":"https://api.github.com/users/OptimusCrime/orgs","repos_url":"https://api.github.com/users/OptimusCrime/repos","events_url":"https://api.github.com/users/OptimusCrime/events{/privacy}","received_events_url":"https://api.github.com/users/OptimusCrime/received_events","type":"User","site_admin":false},"created_at":"2015-08-12T11:58:01Z","updated_at":"2015-08-12T11:58:01Z","body":"Does that mean that this in fact not a bug?"}}