• Resolved Lust

    (@inumedia)


    Hello

    I’m using it for the user author page. My users can upload it on their profil. it’s working well. But When I used the shortcode to display on the author page, it’s showing the picture only if my user is connected. If it’s a guest, and he is not login on the website, he can’t see the profile picture. It’s blank.

    How can we change that ?

    thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Ronald Huereca

    (@ronalfy)

    What code are you using on the front-end to display the photo?

    Thread Starter Lust

    (@inumedia)

    Hello

    I used this in my page:

    <div class="picture-coach">
    						<?php
    							$profilepicture = get_usermeta($user->ID, 'boxing_metronet_image_id', true);
    
    							/**
    							 * Checking if anything exists for the key short
    							 */
    							if( $profilepicture) {
    								echo mt_profile_img( $user_id, array(
    									'size' => 'profile-size',
    									'attr' => array( 'alt' => ''.$user->first_name.'' ),
    									'echo' => true )
    								);
    							} else { 
    								echo '<img src="'.get_template_directory_uri().'/imgs/profil-deft.jpg" width="250px" height="302" />';
    							} 
    						?>
    						</div>

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    • This reply was modified 7 years, 7 months ago by bdbrown.
    Plugin Contributor Ronald Huereca

    (@ronalfy)

    You use $user->ID above. If that variable is good, then you can try replacing user_id with it as I assume that variable is empty without the full code.

    Thread Starter Lust

    (@inumedia)

    yes thanks it works 🙂

    • This reply was modified 7 years, 7 months ago by Lust.
    Plugin Contributor Ronald Huereca

    (@ronalfy)

    👍

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘showing avatar on page’ is closed to new replies.