I have never edited that function. I have not been using a child theme (I know I should) I’ll get around to setting that up soon. I have modified other core theme functions but very minor tweaks.
I would assume the function is being called because my profile picture shows up. But when you inspect the code for the post with no image showing up It just doesn’t write the image tag for users with a permission below Administrator?
The code for ct_tracks_profile_image_output() is this:
function ct_tracks_profile_image_output(){
// use User's profile image, else default to their Gravatar
if(get_the_author_meta('user_profile_image')){
// get the id based on the image's URL
$image_id = ct_tracks_get_image_id(get_the_author_meta('user_profile_image'));
// retrieve the thumbnail size of profile image
$image_thumb = wp_get_attachment_image($image_id, 'thumbnail');
// display the image
echo $image_thumb;
} else {
echo get_avatar( get_the_author_meta( 'ID' ), 72 );
}
}
Ok so with a little debugging I figured out what is happening. I use cloudfront and aws s3 to store my media. When you upload photos to the site they are automatically pushed to an s3 bucket. My user profile was created before I set this up and that image for whatever reason has not been migrated to the s3 bucket.
$image_thumb = wp_get_attachment_image($image_id, 'thumbnail');
is what is not working. I’m pretty sure due to the images being hosted externally wp_get_attachement_image will not work.
Any thoughts on how to modify this it still pulls in the url of the image I added `
..`
$image_thumb = wp_get_attachment_image($image_id, ‘thumbnail’);
print_r(get_the_author_meta(‘user_profile_image’));
..` to see if there was actually a photo attached to the user profile and it indeed returns the full url path to the image. Which is why the default gravitar image was not being display.
I think there is an error in how ct_tracks_get_image_id(); works because there is nothing displayed when I do print_r($image_id); for the affected posts.