• Resolved sebnast

    (@sebnast)


    Hi, i’ve had a look around the forums and google but can’t find the answer to my question.
    Is there a shortcode to display UM user profile pic?

    • This topic was modified 4 years, 9 months ago by sebnast.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @sebnast

    You can try adding the following code snippets to your Theme/Child-Theme’s functions.php file or use the Code Snippets plugin to run the code:

    add_shortcode("um_display_avatar","um_070221_avatar_shortcode");
    function um_070221_avatar_shortcode( $atts ) {
    	$atts = extract( shortcode_atts( array(
    		'user_id' => get_current_user_id(),
        ), $atts ) );
        $image = get_usermeta( $user_id , "profile_photo", true);
        return UM()->uploader()->get_upload_user_base_url( $user_id ) ."/" . $image;
        
    }

    Usage #1: [um_display_avatar] – Displays the currently logged-in user’s profile photo URL

    Usage #2: [um_display_avatar user_id="35"] – Displays the profile photo URL of a specific user.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

    Thread Starter sebnast

    (@sebnast)

    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Shortcode for user avatar’ is closed to new replies.