[Resolved] Get user role works only for administrator.
I’m trying to modificate “Members directory” plugin, so it shows up user role along with website/name/bio.
Here is my code:
Get user id:
$user_idd = $user_details->ID;
Get role of that user:
$user_current = new WP_User( $user_idd ); $role_container = $user_current->roles;
Display user role:
$content .= '<strong>' . __('Rank') . '</strong>: ' . $role_container . '<br />';
The problem is that this code for some reason works only for administrator. When I go to members page and choose administrator, I’m getting “Rank: administrator”, but when I choose contributor or subscriber profile, I’m getting “Rank: “(empty string).
You can check it here:
Any ideas ?
- The topic ‘[Resolved] Get user role works only for administrator.’ is closed to new replies.