Display user role on profile page
-
I would like to display what role a user belongs to on their profile page, e.g.: “Bob (Administrator)”, “Jane (Subscriber)”.
I had a look on the WordPress forums and found some suggestions on how to do this but couldn’t get them to work, and wondered if it might be to do with having Buddypress installed. For example I found this:
`$user = new WP_User( $user_id );
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
echo $role;
}`(source: http://wordpress.org/support/topic/get-a-users-role-by-user-id#post-1363118)
However adding this code had no effect whatsoever.
Can anyone suggest a means of displaying a user’s role on their Buddypress profile page?
I am also using the User Role Editor plugin (http://wordpress.org/extend/plugins/user-role-editor/) to create an extra User Role, which may complicate things.
- The topic ‘Display user role on profile page’ is closed to new replies.