You check for the role for the current user and add the value to the admin bar, like the profile item.
To get the role of the current user use the small function below:
/**
* Returns the translated role of the current user.
* No role, get false.
*
* @return string The translated name of the current role.
**/
function fb_get_current_user_role_fixed() {
global $wp_roles;
$current_user = wp_get_current_user();
$roles = $current_user->roles;
$role = array_shift( $roles );
return isset( $wp_roles->role_names[ $role ] ) ? translate_user_role( $wp_roles->role_names[ $role ] ) : FALSE;
}
Also a example to add the value from the function to the admin bar, in my example a new entry to the account item in the Admin Bar.
add_action( 'admin_bar_menu', 'fb_change_admin_bar_item' );
/**
* Add item to the admin bar, to the my-account item.
*
* @param Array $wp_admin_bar
*/
function fb_change_admin_bar_item( $wp_admin_bar ) {
$args = array(
'id' => 'user_role',
'title' => __( 'Role:' ) . ' ' . fb_get_current_user_role_fixed(),
'parent' => 'my-account'
);
$wp_admin_bar->add_node( $args );
}
See the result as screenshot, much easier to understand the goal of the example.

As alternative the second example, that add the role name to the user name, on the default title in the admin bar.
add_action( 'admin_bar_menu', 'fb_change_admin_bar_item' );
function fb_change_admin_bar_item( $wp_admin_bar ) {
$node = $wp_admin_bar->get_node( 'my-account' );
if ( ! $node ) {
return $wp_admin_bar;
}
$node->title .= ' ' . fb_get_current_user_role_fixed();
$wp_admin_bar->add_node( $node );
}
Also here a screenshot of the result.
