Hi
This shortcode will return the username of the current user:
[vg_display_data key="user_login" data_source="user_data"]
Description of the current user:
[vg_display_data key="description" data_source="user_meta"]
Hi!
Thank you!
How am I able to display the user role?
I have found the way, thank you again!
function get_current_user_role() {
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;
}
add_shortcode(‘current_role’, ‘custom_shortcode_func’);
Our plugin works for displaying the user role as well:
This shortcode will work:
[vg_display_data key="roles" data_source="user_data"]