• Resolved filiippppppp

    (@filiippppppp)


    Hi there, how am I able to display fields such as username, description, etc.?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jose Vega

    (@josevega)

    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"]

    Thread Starter filiippppppp

    (@filiippppppp)

    Hi!

    Thank you!
    How am I able to display the user role?

    Thread Starter filiippppppp

    (@filiippppppp)

    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’);

    Plugin Author Jose Vega

    (@josevega)

    Our plugin works for displaying the user role as well:

    This shortcode will work:
    [vg_display_data key="roles" data_source="user_data"]

    Thread Starter filiippppppp

    (@filiippppppp)

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display username’ is closed to new replies.