• Resolved iceman3333

    (@iceman3333)


    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 to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @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

    (@iceman3333)

    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

    (@champsupertramp)

    Hi @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

    (@iceman3333)

    Hi Champ Camber

    Here the link https://isen-fischer.de/test/

    I can’t move the user to another group or delete the group.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @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

    (@iceman3333)

    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

    (@champsupertramp)

    Hi @iceman3333

    Could you please contact us via [email protected]? I’ll take a closer look at this issue. Please include this topic URL in the email message.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @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

    (@iceman3333)

    Thanks the Support has fix the Prop.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    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.