Title: Error with Roles
Last modified: November 24, 2021

---

# Error with Roles

 *  Resolved [iceman3333](https://wordpress.org/support/users/iceman3333/)
 * (@iceman3333)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/)
 * I have the following error.
 * Undefined index: name in /var/www/vhosts/XXXX/wp/wp-content/plugins/ultimate-
   member/includes/core/class-roles-capabilities.php on line 113
    Undefined index:
   name in /var/xxxx/wp-includes/class-wp-roles.php on line 291
 * I can’t delete or create new roles either.
    There are 2 roles where no name is
   displayed, I can’t delete or edit them. Gr Wolfgang
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferror-with-roles-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 10 replies - 1 through 10 (of 10 total)

 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15102235)
 * Hi [@iceman3333](https://wordpress.org/support/users/iceman3333/)
 * Please try running this code snippet once or twice to remove the corrupted roles:
 *     ```
       add_action("init","um_111521_update_roles");
       function um_111521_update_roles(){
           $wp_roles = get_option("wp_user_roles");
           $um_roles = get_option("um_roles");
           foreach( $um_roles as $role_id => $role ){
               if( $role == "user-role-b" ){
                   unset( $um_roles[ $role_id ] );
               }
           }
   
           foreach( $wp_roles as $role_id => $role ){
               if( $role_id == "um_user-role-b" ){
                   unset( $wp_roles[ $role_id ] );
               }
           }
   
           update_option("wp_user_roles", $wp_roles );
           update_option("um_roles", $um_roles );
   
       }
       ```
   
 * Change the `user-role-b` in the code with the slug of the role that you cannot
   delete or edit.
 * Regards,
 *  Thread Starter [iceman3333](https://wordpress.org/support/users/iceman3333/)
 * (@iceman3333)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15112246)
 * Hello, have pasted this but still can’t delete. Has not changed.
 *     ```
       add_action("init","um_111521_update_roles");
       function um_111521_update_roles(){
           $wp_roles = get_option("wp_user_roles");
           $um_roles = get_option("um_roles");
           foreach( $um_roles as $role_id => $role ){
               if( $role == "um_jungfischer" ){
                   unset( $um_roles[ $role_id ] );
               }
           }
   
           foreach( $wp_roles as $role_id => $role ){
               if( $role_id == "um_jungfischer" ){
                   unset( $wp_roles[ $role_id ] );
               }
           }
   
           update_option("wp_user_roles", $wp_roles );
           update_option("um_roles", $um_roles );
   
       }
       ```
   
 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15120344)
 * Hi [@iceman3333](https://wordpress.org/support/users/iceman3333/)
 * Did you reload the page after adding the code? Could you please provide a screenshot
   of the WP Admin > Ultimate Member > User Roles page?
 * Regards,
 *  Thread Starter [iceman3333](https://wordpress.org/support/users/iceman3333/)
 * (@iceman3333)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15120379)
 * Hi Champ Camber
 * Here the link [https://isen-fischer.de/test/](https://isen-fischer.de/test/)
 * I can’t move the user to another group or delete the group.
 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15120443)
 * Hi [@iceman3333](https://wordpress.org/support/users/iceman3333/)
 * Have you tried re-assigning a new role to the 4 users with “um_jungfischer” role?
   You can re-assign a role in WP Admin > Users. Once the users have a new role,
   try deleting the “um_jungfischer” role with the above code.
 * Regards,
 *  Thread Starter [iceman3333](https://wordpress.org/support/users/iceman3333/)
 * (@iceman3333)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15120721)
 * Hi Champ Camba
 * The 4 users are now members, but are still displayed under the UM Young Fishers.
   I have deleted the user cache. The code I tried again, have also page reloaded
   several times. But can not be deleted.
 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15129336)
 * Hi [@iceman3333](https://wordpress.org/support/users/iceman3333/)
 * Could you please contact us via [team@ultimatemember.com](https://wordpress.org/support/topic/error-with-roles-2/team@ultimatemember.com?output_format=md)?
   I’ll take a closer look at this issue. Please include this topic URL in the email
   message.
 * Regards,
 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15142320)
 * Hi [@iceman3333](https://wordpress.org/support/users/iceman3333/)
 * The issue has been fixed. The code snippet below deletes the roles that have 
   no names:
 *     ```
       add_action("init","um_111521_update_roles");
       function um_111521_update_roles(){
   
       	 $arr_delete_roles = ["jungfischer","custom_role_1","um_jungfischer","um_custom_role_1"];
       	foreach( $arr_delete_roles as $role ){
       	         $has_role = get_role(  $role ) ;
       			if ( get_role(  $role ) ) {
       			  remove_role(  $role );
       			 }
       	}
   
   
       }
       ```
   
 * Regards,
 *  Thread Starter [iceman3333](https://wordpress.org/support/users/iceman3333/)
 * (@iceman3333)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15143461)
 * Thanks the Support has fix the Prop.
 *  Plugin Contributor [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * (@champsupertramp)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15145880)
 * Thanks for letting us know.
 * Regards,

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Error with Roles’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Champ Camba](https://wordpress.org/support/users/champsupertramp/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/error-with-roles-2/#post-15145880)
 * Status: resolved