SHARE
TWEET

Recent Comments and Recent Posts Combination

iftekharul Sep 10th, 2015 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div id="t4b-latest-activities"><?php echo t4b_get_related_author_posts(); ?>
  2.         <div id="t4b-latest-tune">
  3.                 <?php
  4.                         global $wpdb;
  5.                         $userID = get_the_author_meta('ID');
  6.                         $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
  7.                                         comment_post_ID, user_id, comment_approved, comment_date_gmt,
  8.                                         comment_type, SUBSTRING(comment_content,1,30) AS com_excerpt
  9.                                         FROM $wpdb->comments
  10.                                         LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
  11.                                         $wpdb->posts.ID)
  12.                                         WHERE comment_approved = '1' AND comment_type = '' AND
  13.                                         post_password = '' AND user_id = '".$userID."'
  14.                                         ORDER BY comment_date_gmt DESC LIMIT 1";
  15.                         $comments = $wpdb->get_results($sql);
  16.                         if ($comments) :
  17.                                 echo '<div class="comment-real"></div>';
  18.                                 foreach ($comments as $comment) :
  19.                                         echo '<h4><a href="'.get_permalink($comment->ID).'#comment-'.$comment->comment_ID.'">&ldquo;'.strip_tags($comment->com_excerpt).'&hellip;&rdquo;&nbsp;</h4></a>';
  20.                                         echo '<p>' . mysql2date('M j, Y g:i:s a', $comment->comment_date_gmt) . ' ( ' . get_date_time_count($comment->comment_date_gmt) . ' আগে )</p>';
  21.                                 endforeach;
  22.                         else :
  23.                                 echo '<div class="comment-real"></div>';
  24.                                 echo '<h4>আপনি সাম্প্রতিককালে কোন মন্তব্য করেননি।</h4>';
  25.                         endif;
  26.                 ?>
  27.         </div>
  28. </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top