- Code: Select all
function pc_get_userrole ($user_id) {
$user = new WP_User($user_id);
$userclean = $user->roles[0];
return $userclean;
}
Then, where I want the user's role to display, I put this:
- Code: Select all
echo pc_get_userrole(bp_current_user_id());
Works like a charm - on the site, the user's role gets displayed like this:
- Code: Select all
s2member_level1
I know nothing about code; is there a way I can make it so that when the value returned is s2member_level1, as above, the text returned is something like "Auditing Student", and if the value returned is s2member_level1 the text is "Working Student"?
Where to put these statements?
This I know is a pretty simple/dumb question, but I'm a PHP dum dum...
thanks,
Daisy