Gravatar/Avatar always displaying default
-
I am using a theme for https://life2.us and am having a problem in the center footer sidebar. The recent comments are always displaying the default image. I’ve tried several times to add in suggestions from codex. WIth some of the suggestions, it appears as though it’s not pulling the image from gravatar and shows the dreaded x and alt text instead.
Here is the code as it stands:
// Get list of recent comments to display it in sidebar
function show_recent_comments($numberposts=5) {
global $wpdb, $post;
$recentcomments = $wpdb->get_results(“SELECT $wpdb->comments.comment_ID, $wpdb->comments.comment_post_ID, $wpdb->comments.comment_author, $wpdb->comments.comment_content, $wpdb->comments.comment_author_email FROM $wpdb->comments WHERE $wpdb->comments.comment_approved=1 ORDER BY $wpdb->comments.comment_date DESC LIMIT $numberposts”, OBJECT);
$i=0;
foreach ($recentcomments as $rc) {
$post = get_post($rc->comment_post_ID);
$i++;
//gravatar code for < 2.5 & 2.5+
$Img = “https://www.gravatar.com/avatar.php?gravatar_id=” . md5($rc->comment_author_email) . “&default=” . urlencode($default) . “&size=40”;
?>Thanks in advance.
- The topic ‘Gravatar/Avatar always displaying default’ is closed to new replies.