{"id":9998149,"date":"2018-02-21T11:37:35","date_gmt":"2018-02-21T11:37:35","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/ret-registrants-as-authors\/"},"modified":"2018-02-21T11:38:20","modified_gmt":"2018-02-21T11:38:20","slug":"ret-registrants-as-authors","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/ret-registrants-as-authors\/","title":{"rendered":"Set registrants as authors?"},"content":{"rendered":"<p>Hi,<\/p>\n<p>Quick question, I&#8217;m using TML for users to register but I need them to be able to create posts, so I want them to be authors and not subscribers. I have activation turned on so they are pending to begin with, but subsequently I need their role to go to author. Seems the default behaviour is &#8216;subscriber&#8217; but is there any way to change this? I&#8217;ve tried this function:<\/p>\n<pre><code>\nadd_action(&#039;tml_new_user_registered&#039;, &#039;\\Bbc\\set_user_to_author&#039;);\nfunction set_user_to_author($userID){\n  $u = new \\WP_User($userID);\n  $u-&gt;remove_role(&#039;subscriber&#039;);\n  $u-&gt;add_role(&#039;author&#039;);\n  return;\n}\n<\/code><\/pre>\n<p>But it doesn&#8217;t seem to work.<\/p>\n<p>Much appreciated<br \/>\nKevin<\/p>\n","protected":false},"template":"","class_list":["post-9998149","topic","type-topic","status-publish","hentry","topic-tag-tml"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9998149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9998149\/revisions"}],"predecessor-version":[{"id":9998154,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/9998149\/revisions\/9998154"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=9998149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}