WordPress.org

Ready to get started?Download WordPress

Forums

WP_User->remove_role wrong -- code change (2 posts)

  1. javalizard
    Member
    Posted 6 years ago #

    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

  2. javalizard
    Member
    Posted 6 years ago #

    While your at this one, can you fix this one too?
    http://wordpress.org/support/topic/132841?replies=1

    I'm having both of these issues with roles

Topic Closed

This topic has been closed to new replies.

About this Topic