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,
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 );
}
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,
Hi Champ Camber
Here the link https://isen-fischer.de/test/
I can’t move the user to another group or delete the group.
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,
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.
Hi @iceman3333
Could you please contact us via team@ultimatemember.com? I’ll take a closer look at this issue. Please include this topic URL in the email message.
Regards,
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,
Thanks the Support has fix the Prop.
Thanks for letting us know.
Regards,