WordPress.org

Ready to get started?Download WordPress

Forums

remove_role() possible bug (1 post)

  1. Vladimir Garagulya
    Member
    Posted 4 years ago #

    remove_role() function in capabilities.php has the return operator

    return $wp_roles->remove_role( $role );

    But $wp_roles->remove_role() returns nothing

    function remove_role( $role )
    if ( ! isset( $this->role_objects[$role] ) )
    return;
    unset( $this->role_objects[$role] );
    unset( $this->role_names[$role] );
    unset( $this->roles[$role] );
    if ( $this->use_db )
    update_option( $this->role_key, $this->roles );
    }

    I think it should be

    function remove_role( $role ) {
    if ( ! isset( $this->role_objects[$role] ) )
    return false;
    unset( $this->role_objects[$role] );
    unset( $this->role_names[$role] );
    unset( $this->roles[$role] );
    if ( $this->use_db )
    return update_option( $this->role_key, $this->roles );
    } else {
    return true;
    }

    Please confirm if this bug is known or not.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 4 years ago by Vladimir Garagulya
  • This topic is not resolved
  • WordPress version: 2.9.2

Tags