Make WordPress Core

Changeset 21866


Ignore:
Timestamp:
09/16/2012 04:24:33 PM (12 years ago)
Author:
nacin
Message:

Don't use hard-coded indexes when dealing with an array of roles. props elyobo. fixes #19222.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ajax-actions.php

    r21814 r21866  
    10231023    $wp_list_table = _get_list_table('WP_Users_List_Table');
    10241024
     1025    $role = current( $user_object->roles );
     1026
    10251027    $x = new WP_Ajax_Response( array(
    10261028        'what' => 'user',
    10271029        'id' => $user_id,
    1028         'data' => $wp_list_table->single_row( $user_object, '', $user_object->roles[0] ),
     1030        'data' => $wp_list_table->single_row( $user_object, '', $role ),
    10291031        'supplemental' => array(
    10301032            'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
    1031             'role' => $user_object->roles[0]
     1033            'role' => $role,
    10321034        )
    10331035    ) );
  • trunk/wp-includes/capabilities.php

    r21563 r21866  
    787787            unset( $this->caps[$oldrole] );
    788788
    789         if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
     789        if ( 1 == count( $this->roles ) && $role == current( $this->roles ) )
    790790            return;
    791791
Note: See TracChangeset for help on using the changeset viewer.