I’m creating a site with a social feel to it for a client.
Users have profiles that uses $_GET to serve up their info.
So their urls look like this /profile/?userid=1
the page /profile/ uses a template I created to do this.
I want to use WordPress’s commenting system for the user’s comment wall.
Is there a way to change the loop to find comments for the user’s id rather than the page’s id which will stay the same on every user’s profile?
If any one else ever has this problem its in line 884 of code in the wp-includes/comments-template.php file
$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) ) ORDER BY comment_date_gmt",$post->ID , $user_ID));
Change “$post->ID” to “$_GET[userid]”
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Need a Comments hack’ is closed to new replies.