Hallo zusammen!
Folgenden Code habe ich bei mir laufen, um die Top-Kommentatoren mit ihren Gravataren anzeigen zu lassen. leider wird bei allen nur der Standard-Gravatar angezeigt:
PHP
function top_commentator_all() { global $wpdb; $i = 0; ?> <div class="walloffame_container"> <?php $topcommentator_query="SELECT comment_author, comment_author_email, comment_type, SUBSTRING_INDEX(REPLACE(comment_author_url, 'www.', ''), '/', 3) as top_commentator, COUNT(*) as top_num FROM $wpdb->comments WHERE comment_approved='1' AND comment_author_url IS NOT NULL AND comment_author_url != '' AND comment_author_email NOT LIKE '@themenfreund.de%' AND comment_author_url NOT LIKE 'http://facebook.com/%' AND comment_author_url NOT LIKE 'http://themenfreund.de%' AND comment_author_url NOT LIKE 'http://twitter.com%' AND comment_type NOT LIKE 'pingback' OR 'trackback' GROUP BY top_commentator Order by top_num DESC, comment_date ASC LIMIT 18"; $topcommentator_result = $wpdb->get_results($topcommentator_query); if ( !empty($topcommentator_result) ) { foreach ($topcommentator_result as $comment) : $co_aut = $comment->top_commentator; $co_aut = str_ireplace("http://", "", $co_aut); ?> <div class="walloffame_stage" style="cursor: pointer;"> <div class="walloffame_avatar"> <?php echo '<a href="'.$comment->top_commentator.'/" target="_blank">'.get_avatar( $comment, 164 ) .'</a>'; ?> </div> <div class="walloffame_info"> <span class="walloffame_name" > <?php echo $comment->comment_author.' <br />'; ?> </span> <span class="walloffame_total"> <?php echo $comment->top_num.' Kommentare'; ?> </span> </div> </div> <?php $i++; if($i%3==0) { ?> <?php } endforeach; $i=0; } ?> </div> <?php } ?>
Die Sache hat mal funktioniert.
Woran kann das evtl. liegen?