WordPress.org

Forums

Custom User Profile Photo
Can't see the avatar (6 posts)

  1. Lobsterdm
    Member
    Posted 1 year ago #

    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://wordpress.org/plugins/custom-user-profile-photo/

  2. TrishaM
    Member
    Posted 1 year ago #

    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!

  3. TrishaM
    Member
    Posted 1 year ago #

    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!

  4. 3five
    Member
    Plugin Author

    Posted 4 months ago #

    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.

  5. drewmigdal
    Member
    Posted 4 months ago #

    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!

  6. 3five
    Member
    Plugin Author

    Posted 4 months ago #

    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: http://codex.wordpress.org/Function_Reference/get_the_author_meta

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom User Profile Photo
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.