Title: action hook when role changes
Last modified: November 1, 2017

---

# action hook when role changes

 *  Resolved [grebos](https://wordpress.org/support/users/grebos/)
 * (@grebos)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/action-hook-when-role-changes/)
 * Is there an action hook, when role of a user role changes. For me the standart
   wordpress hook [set_user_role](https://codex.wordpress.org/Plugin_API/Action_Reference/set_user_role)
   does not fire.
    The [profile_update](https://codex.wordpress.org/Plugin_API/Action_Reference/profile_update)
   does fire but gives the same roles on the $old_user_data and new user data (receved
   by get_userdata($user_id)). When i set the priority to 10 (and probably also 
   lower), it gives the old ones and when setting it to 11 (or higher) it gives 
   the new ones.
 * When I’m right, then in between those priorities the hook
    `add_action( 'profile_update',
   array( $this, 'role_update' ), 10, 2 );` from members\admin\class-user-edit.php
   gets fired. Is there a hook somewhere or must i Hack in there with some temporary
   variable to store the old data by a hook with lover priority and read to compare
   by a hook with higher priority? (Or does anyone have a better Idea on how to 
   do this)
    -  This topic was modified 8 years, 7 months ago by [grebos](https://wordpress.org/support/users/grebos/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Justin Tadlock](https://wordpress.org/support/users/greenshady/)
 * (@greenshady)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/action-hook-when-role-changes/#post-9641515)
 * You’ll want to look into these hooks:
 * [https://developer.wordpress.org/reference/hooks/add_user_role/](https://developer.wordpress.org/reference/hooks/add_user_role/)
 * [https://developer.wordpress.org/reference/hooks/remove_user_role/](https://developer.wordpress.org/reference/hooks/remove_user_role/)
 *  Thread Starter [grebos](https://wordpress.org/support/users/grebos/)
 * (@grebos)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/action-hook-when-role-changes/#post-9644449)
 * Thanks, this work perfectly

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘action hook when role changes’ is closed to new replies.

 * ![](https://ps.w.org/members/assets/icon-256x256.png?rev=3508404)
 * [Members - Membership & User Role Editor Plugin](https://wordpress.org/plugins/members/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/members/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/members/)
 * [Active Topics](https://wordpress.org/support/plugin/members/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/members/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/members/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [grebos](https://wordpress.org/support/users/grebos/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/action-hook-when-role-changes/#post-9644449)
 * Status: resolved