get_role_name
Description
This method is similar to UM()->user()->get_role() but returns the role name instead of the slug. The function get_role_name requires a parameter equal to a Role ID or a Role slug.
Usage
$role_slug = UM()->user()->get_role(); // Get current user's primary role slug. $role_name = UM()->roles()->get_role_name( $role_slug );
Returns
The user role’s name.
Examples
Do something if the user’s role is Paid Customer
$role_name = UM()->roles()->get_role_name( 'paid-customer' ); echo $role_name; // outputs "Paid Customer"