Comment Count for each Comment Author

Place this in your functions.php theme file: <?php function ps_count_user_comments() { global $wpdb; $count = $wpdb->get_var( ‘SELECT COUNT(comment_ID) FROM ‘ . $wpdb->comments. ‘ WHERE comment_author_email = “‘ . get_comment_author_email() . ‘” AND comment_approved = “1” AND comment_type IN (“comment”, “”)’ ); return $count . ‘ comments’; } ?> This code will count the author comments … Read more

How do I set up real anonymous posting in bbpress forums? [closed]

When we post an empty anonymous reply, we get the following errors: The part of BBPress that’s responsible for handling this, is the bbp_new_reply_handler() function, in the file /bbpress/includes/replies/functions.php. It contains these lines that are of interest to us: // User is anonymous if ( bbp_is_anonymous() ) { // Filter anonymous data $anonymous_data = bbp_filter_anonymous_post_data(); … Read more

Disabling Comment Notifications for Post Author

I skimmed through the source of the wp_notify_postauthor() function and noticed the comment_notification_recipients filter. I wonder if you could simplify your plugin to the following code snippet: <?php /** * Plugin Name: Disable comment/trackback/pingback notifications emails * Plugin URI: http://wordpress.stackexchange.com/a/150141/26350 */ add_filter( ‘comment_notification_recipients’, ‘__return_empty_array’, PHP_INT_MAX ); add_filter( ‘comment_moderation_recipients’, ‘__return_empty_array’, PHP_INT_MAX ); where we use an … Read more

Exclude comments from a WP_Query object?

Did you actually find a case where there are any real comments in the wp-query object after running a normal query? If you examine the code in class-wp-query.php, you should find that the comments field only is populated with comments when a “comments-feed” is being queried for. In normal operation, comments are not retrieved by … Read more

What are the current recommended best-practices for comments.php?

You really don’t need much. A headline with id=comments <h2 id=”comments”><?php comments_number(); ?></h2> This will be the target for comments_link() in the article loop. Links for paginated comments. Usually, I put these links into a function and call the function above and below the comments list: class TTT_Template { function comment_pager() { if ( get_comment_pages_count() … Read more

How is comment spam received without a comments form?

You don’t need a form to submit a comment to the wp-comments-post.php file, or to send a pingback or trackback. Spammers don’t use forms, they simply send their spam directly. Removing the form doesn’t “turn off” comments. To do that, go to the Posts screen, and use the Quick Edit to actually disable comments and … Read more

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