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

git-svn-id: https://develop.svn.wordpress.org/trunk@21866 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2012-09-16 16:24:33 +00:00
parent 9447d32ef4
commit fee76161e3
2 changed files with 5 additions and 3 deletions

View File

@@ -786,7 +786,7 @@ class WP_User {
foreach ( (array) $this->roles as $oldrole )
unset( $this->caps[$oldrole] );
if ( 1 == count( $this->roles ) && $role == $this->roles[0] )
if ( 1 == count( $this->roles ) && $role == current( $this->roles ) )
return;
if ( !empty( $role ) ) {