• Resolved cim

    (@cim)


    Hi I was wondering if the shortcode accepts a user’s ID as a parameter? I couldn’t find any documentations on this.

    Example:
    echo do_shortcode('[avatar_upload id='.$user_id.']');

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,
    You have to use this code
    <?php echo do_shortcode('[avatar user = ID]'); ?> to display user avatar by user ID.

    You can also use this shortcode [avatar user = ID]
    I hope it helps you.

    Thanks

    • This reply was modified 6 years, 6 months ago by erdivyang10.
    Thread Starter cim

    (@cim)

    Hi, thanks for the response. I don’t want to show their avatar, I want to change their avatars on the front end. Right now, it will only change only my own avatar on the front end. Does [avatar_upload] accept ID parameter or any parameters?

    Yes it accepts user ID, Please use this shortcode [avatar_upload user = ID]
    You only need to insert the User ID along with a shortcode.
    I hope it helps you.

    Thanks

    Thread Starter cim

    (@cim)

    That worked, thank you! I had to set a conditional:

    if (user_can( $current_user, 'administrator')) {
    	echo do_shortcode('[avatar_upload user="'.$user->ID.'"]');
    }
    else {
    	echo do_shortcode('[avatar_upload]');
    }

    Thank you again!

    <?php echo do_shortcode(‘[avatar user = ID]’); ?> [avatar_upload user = ID]

    <?pop echo do_shortcode(‘[avatar user=ID]’);?>
    [avatar_upload user=ID]

    <?pop echo do_shortcode(‘[avatar user=ID]’);?>
    [avatar_upload user=ID]Test

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Change user’s avatar on frontend?’ is closed to new replies.