• Resolved thisisrhun

    (@thisisrhun)


    Hi, I was wondering if it would be possible to upload an avatar for a specific user, using a shortcode like this, maybe:

    [user_profile_avatar_upload user_id={$user_id}]

    I was looking t’hough the code and I found a little modification that should work. Maybe you want to implement it in the next update.

    Changing line 90 in wp-user-profile-profile-avatar-shortcodes.php from this:

    
    $user_id = get_current_user_id();
    

    to this:

    
    $user_id = ( is_array( $atts ) AND array_key_exists( 'user_id', $atts ) AND is_numeric( $atts['user_id'] ) ) ? $atts['user_id'] : get_current_user_id();
    

    This checks if the array $atts exists, if user_id exists within $atts and if it is a number. If so, it gets that as the user to attach the avatar to.

    Please let me know if you would consider this petition, as this is something I need for my website.

    Sincerely,
    Ramon Ruiz

Viewing 1 replies (of 1 total)
  • I’d be interested in this too, as I was surprised this wasn’t already an option.

    It seems like a straightforward update. Thanks for documenting it Ramon.

    – Phil Wooldridge

    • This reply was modified 2 years, 3 months ago by philjw.
Viewing 1 replies (of 1 total)
  • The topic ‘Upload an avatar for a specific user’ is closed to new replies.