<ol class="commentlist" id="comments"> <?php foreach ($comments as $comment) { ?> <li <?php echo $oddcomment; ?> id="comment-<?php comment_ID(); ?> "> <div class="comment-details"> <?php bp_comment_author_avatar(); ?> <p><?php comment_author_link(); ?> <?php _e('said:', 'buddypress'); ?> </p> </div> <div class="comment-content"> <?php if ($comment->comment_approved == '0') { ?> <p><strong><?php
function widget($args, $instance) { // outputs the content of the widget extract($args); // Make before_widget, etc available. $rc_name = empty($instance['title']) ? __('Recent Comments', TEMPLATE_DOMAIN) : apply_filters('widget_title', $instance['title']); $rc_avatar = $instance['avatar_on']; $rc_number = $instance['number']; $unique_id = $args['widget_id']; global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,\ncomment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved,\ncomment_type,comment_author_url,\nSUBSTRING(comment_content,1,80) AS com_excerpt\nFROM {$wpdb->comments}\nLEFT OUTER JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID =\n{$wpdb->posts}.ID)\nWHERE comment_approved = '1' AND comment_type = '' AND\npost_password = ''\nORDER BY comment_date_gmt DESC LIMIT {$rc_number}"; $comments = $wpdb->get_results($sql); $output = $pre_HTML; echo $before_widget; echo $before_title . $rc_name . $after_title; echo "<ul class='item-list' id='recent-comments'> "; foreach ($comments as $comment) { $grav_email = $comment->comment_author_email; $grav_name = $comment->comment_author_name; $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=" . md5($email) . "&size=32"; ?> <li> <?php if ($rc_avatar == 'yes') { ?> <div class="item-avatar"> <?php if ($bp_existed == 'true') { echo bp_comment_author_avatar(); } else { echo get_avatar($grav_email, '50'); } ?> </div> <?php } ?> <div<?php if ($rc_avatar == 'no') { ?> style="width: 100% !important;"<?php } ?> class="item"> <span class="activity"><?php echo strip_tags($comment->comment_author); ?> <?php _e("says", TEMPLATE_DOMAIN); ?> </span> <br /> <a href="<?php echo get_permalink($comment->ID); ?> #comment-<?php echo $comment->comment_ID; ?> " title="<?php _e('on', TEMPLATE_DOMAIN); ?> <?php echo $comment->post_title; ?> "> <?php echo strip_tags($comment->com_excerpt); ?> ... </a> </div> </li> <?php } echo "</ul> "; echo $after_widget; }