Hi,
Great plugin – I’m trying to do a custom table showing all users and their renamed roles (e.g. subscriber is now ‘student’.
Any new roles created using URE are shown correctly, but existing user types (author, contributor etc) are shown as the original names.
Here is our code snippet
$userListStr.= '<table>';
foreach ( $blogusers as $user )
{
$userEmail = esc_html( $user->user_email );
$userDisplayName = esc_html( $user->user_nicename );
$userID = $user->ID;
$capabilities = $user->{$wpdb->prefix . 'capabilities'};
if ( !isset( $wp_roles ) )
$wp_roles = new WP_Roles();
foreach ( $wp_roles->role_names as $role => $name ) :
if ( array_key_exists( $role, $capabilities ) )
$thisUserPermissions = $role;
endforeach;
$userListStr.= '<tr>';
$userListStr.= '<td>' . $userDisplayName . '</td>';
$userListStr.= '<td>' . $thisUserPermissions . '</td>';
$userListStr.= '</tr>';
}
$userListStr.= '</table>';
Could you send me a snippet of how to get the URE renamed role of a user given a userID.
Hopefully that makes sense thanks!
Alex