The MU forums have moved to WordPress.org

Hooking Plugin to a Change of User Role (3 posts)

  1. SekJal
    Member
    Posted 16 years ago #

    In the plugin I'm writing, I'd like to execute a function after a user's role on a blog is changed from 'Requestor' (created for this plugin) to any other role on the blog. I have been unable to find any hook that will let me add my action at the appropriate time.

    Am I overlooking something? How 'close' can I get to the change of user role to add my function? Would query or update_user_query help?

  2. SekJal
    Member
    Posted 16 years ago #

    I've gone in and added a hook, around line 145 of wp-admin/user.php, in the 'promote' case of the switch($action) statement. This allows actions to be added just before the user's role is updated. The user id, old role and new role as passed as parameters.

  3. theapparatus
    Member
    Posted 16 years ago #

    That should work. Feel free to submit this patch if you want to the trac:

    http://trac.mu.wordpress.org

About this Topic

  • Started 16 years ago by SekJal
  • Latest reply from theapparatus