WordPress.org

Make WordPress Core

Ticket #10716: roleaction.patch

File roleaction.patch, 1005 bytes (added by usermrpapa, 5 years ago)
  • wp-admin/includes/user.php

     
    7777 
    7878                // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. 
    7979                if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' )) 
     80                { 
    8081                        $user->role = $_POST['role']; 
     82                        do_action('user_role_update', $user_id); 
     83                } 
    8184 
    8285                // If the new role isn't editable by the logged-in user die with error 
    8386                $editable_roles = get_editable_roles(); 
  • wp-admin/users.php

     
    6565 
    6666                $user = new WP_User($id); 
    6767                $user->set_role($_REQUEST['new_role']); 
     68                do_action('user_role_update', $id); 
    6869        } 
    6970 
    7071        wp_redirect(add_query_arg('update', $update, $redirect));