how to find user ids of all commenters in a post

The get_comments() answer by Poulomi Nag is correct. This will be somewhat more efficient. global $wpdb, $post; $query = sprintf(“SELECT user_id FROM {$wpdb->comments} JOIN {$wpdb->posts} ON {$wpdb->posts}.ID = {$wpdb->comments}.comment_post_ID WHERE comment_post_ID = %d AND comment_approved = ‘1’”, $post->ID); $authors = $wpdb->get_col($query); $authors = array_unique($authors); $authors = array_diff($authors,array(‘0’)); // Remove those where users are not registered … Read more

Limit user to one comment

<?php global $current_user; $args = array( ‘user_id’ => $current_user->ID, ‘post_id’ = 100, // post ID. Can be ‘$post->ID’ depending where you are calling this from ‘count’ => true ); if(get_comments($args) >= 1){ echo ‘disabled’; } else { comment_form(); } Function_Reference/get_comments Based on AndrettiMilas code.

Changing “submitted on date” of comments

I presume you mean the format of the date that is displayed for the comment. Different themes will do this different ways, but in general there should be a comments.php file which should contain what makes up a comment. In here should be wp_list_comments(); You will need to add a callback in here which will … Read more

Compact pingback list with favicons

The first you do: separate regular comments and pingbacks. In your comments.php set the type parameter for both: <ol class=”commentlist”> <?php // show regular comments wp_list_comments( array ( ‘type’ => ‘comment’, ‘style’ => ‘ul’ ) ); ?></ol> <ol class=”pinglist”> <?php // show pingbacks and trackbacks, short: “pings” wp_list_comments( array ( ‘type’ => ‘pings’, ‘style’ => … Read more

wp_insert_comment and security

wp_insert_comment() is low level function, it only saves passed data without concern for what it contains. If you are looking to replicate sanitizing WP does on comment data (totally good idea 🙂 you are probably looking for higher level wp_new_comment().

Cannot get local avatars to show [closed]

Debug ideas: You could try to see if this has any effect: add_filter( ‘bp_core_fetch_avatar_no_grav’, ‘__return_true’ ); But you should check out the parameters that go through the bp_core_fetch_avatar filter to see if they are correct (untested): add_filter( ‘bp_core_fetch_avatar’, ‘my_bp_core_fetch_avatar’, 99, 9 ); function my_bp_core_fetch_avatar( $html, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir ) { … Read more

Removing from Comment

wp_list_comments() accepts a walker in the array of its first parameter. This is a class that renders the output. If you don’t provide one, the default class will be used, Walker_Comment. You can find it in wp-includes/comment-template.php. To change the complete comment list out, create a custom walker in your functions.php which extends the default … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)