{"id":15806688,"date":"2022-07-07T17:39:23","date_gmt":"2022-07-07T17:39:23","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/set_user_role\/"},"modified":"2022-07-07T17:39:23","modified_gmt":"2022-07-07T17:39:23","slug":"set_user_role","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/set_user_role\/","title":{"rendered":"set_user_role"},"content":{"rendered":"<p>I need to detect when a uses role is changed. I should be able to:<\/p>\n<pre><code>add_action( &#039;set_user_role&#039;, function( $user_id, $role, $old_roles ) \n{\n    \/\/  code ...\n\n}, 10, 3 );<\/code><\/pre>\n<p>However with Members activated &#8216;set_user_role&#8217; appears to not fire when a role is changed. Disabling Member allows it to fire, but then I am back to only being able to give a user one role. Is there a hook in members that would allow me to detect when a role is changed.  <\/p>\n","protected":false},"template":"","class_list":["post-15806688","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15806688","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":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15806688\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15806688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}