• Lobsterdm

    (@lobsterdm)


    Hi,
    I’ve installed your plugin and copied the code below into my theme but the images aren’t showing.

    <?php
    // Retrieve The Post’s Author ID
    $user_id = get_the_author_meta(‘ID’);
    // Set the image size. Accepts all registered images sizes and array(int, int)
    $size = ‘thumbnail’;

    // Get the image URL using the author ID and image size params
    $imgURL = get_cupp_meta($user_id, $size);

    // Print the image on the page
    echo ‘<img src=”‘. $imgURL .'” alt=””>’;
    ?>

    Please advise

    https://www.ads-software.com/plugins/custom-user-profile-photo/

Viewing 5 replies - 1 through 5 (of 5 total)
  • I have this same problem – I’ve followed the instructions for displaying the user profile photo, but nothing displays. In the source code, it just shows:

    <img src=”” alt=””>

    I’ve verified that an image for the author has been uploaded.

    Please help!

    Well I figured this out – posting my solution in case it helps anyone else.

    It appears that “get_cupp_meta” is not working, so instead of trying to modify the plugin, I just changed the snippet used in my template to pull the correct URL to the profile pic out of the author meta. When I looked at the usermeta table, it shows the key for the URL to the photo as “cupp_upload_meta”.

    SO in the code snippet as shown:

    // Get the image URL using the author ID and image size params
    $imgURL = get_cupp_meta($user_id, $size);

    I changed it to be:

    $imgURL = get_the_author_meta(‘cupp_upload_meta’, $user_id)

    Then where I want my image to appear I just called the <img> tag and hard-coded in the size of the photo I wanted in the template.

    SO the complete code snippet – where you want the author photo to be – is:

    <?php
    // Retrieve The Post's Author ID
    $user_id = get_the_author_meta('ID');
    // Get the image URL using the author ID
    $imgURL = get_the_author_meta('cupp_upload_meta', $user_id)
    ?>
    <img src="<?php echo $imgURL; ?>" width="100" height="128" alt="<?php the_author(); ?>" title="<?php the_author(); ?>" ?>" />

    Change the image dimensions as you need to. Hopefully the plugin author will address this soon!

    Hello all,
    Thanks for the response here. Sorry to hear about the trouble you had with the plugin.

    Could you please elaborate on the code where you are using the get_cupp_meta() function? Is this within the loop or outside of the loop? On an archive, single, or page template? The odd thing is that that is the exact hook (get_the_author_meta) within the function that is being used to get the url so I’m not sure why it wouldn’t work with the plugin’s function.

    Sorry for the late response by the way.

    Thanks.

    I’m kind of new at WP. Where exactly am I supposed to paste the code so I can see my pic on the front end?
    Thanks!

    You can paste this code into your tempalte_name.php file(s). For example, place the code into your single.php file and the photo would show up for the author of that singular post.
    You might need to modify the code to get the proper author_id. you can find that info here: https://codex.www.ads-software.com/Function_Reference/get_the_author_meta

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can't see the avatar’ is closed to new replies.