Role label like on here
Hi,
I searched, but could not find anything on how to have role labels like Staff do on here.
How is this possible?
Thanks!
Which link to you mean? I guess he`s referring to this: http://fs5.directupload.net/images/160609/mig2tv8e.png
i think that might work with user roles
@Zoker yes that’s what I mean 🙂 Any idea how to add? Thanks
I guess @rahularyan has to answer that, I don’t have any idea
Use this css@audran
.role-label {
background: #43a8ef none repeat scroll 0 0;
border-radius: 2px;
color: #fff;
font-size: 12px;
margin-left: 3px;
padding: 0 5px;
}
I was able to achieve this by modifying a bit the code from this question: https://anspress.io/questions/question/displaying-pmp-membership-type-under-name/
You just need to remove the part that checks PMPro user level. Here is the code I used:
/** * Append user level information *@param string $name User name. *@param array $args Name arguments. **/ function io_ap_user_display_name( $name, $args ) { if ( user_can( $args['user_id'], 'ap_moderator' ) || is_super_admin( $args['user_id'] ) ) { $level_name = 'Staff'; } if ( empty( $level_name ) ) { return $name; } if ( $args['html'] ) { return $name . '<span class="role-label level-'.strtolower($level_name ).'">'. $level_name.'</span>'; } return $name . ' ('. $level_name.')'; } add_filter('ap_user_display_name', 'io_ap_user_display_name', 10, 2 );
Thank you for this code ! I’d like to change the color of the text but I don’t how to do it …
Can you help me please ? 🙂
Link is missing