WordPress.org

Support

Support » How-To and Troubleshooting » WP_User->remove_role wrong — code change

WP_User->remove_role wrong — code change

  • Hello all, I think there is an error in the WP_User->remove_role function.

    This needs to be fixed:

    if ( empty($this->roles[$role]) ||
    (count($this->roles) <= 1) )
                            return;
                    unset($this->caps[$role]);
                    update_usermeta($this->ID, $this->cap_key, $this->caps);
                    $this->get_role_caps();

    should be this:

    if ( empty($this->caps[$role]) ||
    (count($this->caps) <= 1) )
                            return;
                    unset($this->caps[$role]);
                    update_usermeta($this->ID, $this->cap_key, $this->caps);
                    $this->get_role_caps();

    This has been stopping me from removing a user from a role. I’ve been manually fixing it with each new install but it should make it into the code base

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WP_User->remove_role wrong — code change’ is closed to new replies.
Skip to toolbar