Hopeyou can help!
]]> global $ultimatemember;
$user_id = get_current_user_id();
um_fetch_user( $user_id );
$role = um_user('role_name');
$display_name = um_user('display_name');
ob_start( );
echo "<p>User ID: $user_id</p>\n";
echo "<p>User Name: $display_name</p>\n";
echo "<p>Role: $role</p>\n";
return ob_get_clean( );
]]>Is it possible to support localizations on those pages?
* Example:
add_role('add_man', esc_html__( 'Addvertising Manager', 'my-own-theme' ),
That’s simple and great plugin, I love it.
But I’m using it for my Vietnamese website. I want to show user role (Logged in User Name) with translated one (role name) but this plugin seems only to show the role-ID.
e.g: “Subscriber” –> “Thành viên”
So I can’t translate my own “Logged in User Name” for user (because the role-ID can’t be non-english characters and without space).
Could you please provide some advises and solution for that case?
Thanks in advanced!
https://www.ads-software.com/plugins/tt-sidebar-login-widget/
]]>So what I want to do is somehow access the “Role Label” from the db for the current user.
What I have figured out so far is to get the current users role name, and get it from the db where role name = current users role name.
My problem is I do not know exactly what to query to compare and get the values.
Here is what I have come up with (with help of other forum users posts as reference)
function dirty_get_role(){
global $wpdb, $current_user;
$user_role = "";
if (is_user_logged_in()){
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
}
$role = explode('"',$wpdb->get_var("SELECT option_value FROM wp_options WHERE option_name = 'wp_user_roles' and role_name = '$user_role'"));
return $role[1];
}
I can get the current users role name with no problem, its just getting the role label that I need help with.
Thanks
]]>