Get recent comments from a specific array of users?
-
Hi, I am trying to display a list of recent comments from several specific users (in my case user ids 14,56,58,200) who form a team. On their team page I simply want to list their recent comments.
I feel like I’m nearly there, as on each team members individual page I run a query that displays that one team members comments, using this code:
<?php $args = array( 'user_id' => 200, // TEAM MEMBER 'number' => 3, // how many comments to retrieve 'status' => 'approve' ); $comments = get_comments( $args ); if ( $comments ) { $output.= "<ul class=lastcomments>\n"; foreach ( $comments as $c ) { $output.= '<li><p>'; $output.= get_comment_excerpt($c->comment_ID); $output.= '</br><span>Posted in: <a href="'.get_comment_link( $c->comment_ID ).'">'; $output.= get_the_title($c->comment_post_ID); $output.= '</a>'; $output.= ' on '. mysql2date('m/d/Y', $c->comment_date, $translate); $output.= "</span></p></li>\n"; } $output.= '</ul>'; echo $output; } else { echo "No comments made";}?>
All attempts to display multiple users comments, however (using an array for user_id for example) have failed so far. The formatting of the list needs to be the same, just with 5 specified users instead of 1.
I have hit a coding wall. Any help would be greatly appreciated!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get recent comments from a specific array of users?’ is closed to new replies.