How can I get list of emails of users who commented on a post?

global $wpdb, $post; $query = sprintf(“SELECT comment_author_email 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); $emails = $wpdb->get_col($query); $emails = array_unique($emails); // your e-mails print_r($emails); You can also use the built-in WP_Comment_Query (or get_comments), but it’s going to be a little slower…

Commenting system for WordPress

When you use Disqus you are in a way giving away the control to that company. The module is indeed very nicely built, you can access Disqus admin section from within your WP admin panel, but like I said; you are handing over the “root control” to Disqus.

Show Social Sharing Buttons And Facebook Comments In Lightbox Modal Dialog (Image Overlay)?

You can show Facebook and Pinterest sharing tools on the Nextgen lightbox with this tool: http://sharemygallery.com You want a facebook comment box. Unfortunately, this doesn’t do that. This plugin puts Facebook and Pinterest sharing buttons at the bottom of the image browser. It may help you if you just want to get people stared sharing … Read more

Get comments only for certain specific users in template file

You can try to modify the query using the comments_clauses filter: $args = array( ‘user_id’ => 0 ); add_filter( ‘comments_clauses’, ‘custom_comments_clauses’); $comments = get_comments( $args ); remove_filter( ‘comments_clauses’, ‘custom_comments_clauses’); function custom_comments_clauses( $clauses ){ $clauses[‘where’] = str_replace( ‘user_id = 0’, ‘user_id IN (1, 2, 3)’, $clauses[‘where’] ); return $clauses; } Update: You could also add a … Read more

Safely editing core files

There is no “safe” way to edit core files; if you do you will need to check and repeat the edition after every update. Not recommended at all. Instead of editing core files, you could use any of the actions and filters available. For example, pre_comment_on_post (example code not tested): add_action( ‘pre_comment_on_post’, function( $post_id ) … Read more

Minimum allowed comment length only on a specific page

is_page() is not available at that point try using global $post that way the post ID should be available for comparison. add_filter( ‘preprocess_comment’, ‘wpb_preprocess_comment’ ); function wpb_preprocess_comment($comment) { global $post; if ((strlen( $comment[‘comment_content’] ) < 60 ) && ($post->ID == 42)) { wp_die(‘Minimum allowed comment length is 60 characters.’); } return $comment; }

Replace comments with a dummy text

Yes, possible. Add this to your theme’s functions.php file- add_filter( ‘get_comment_text’, ‘replace_comment_texts’ ); function replace_comment_texts() { return “This comment is hidden”; } I have written a plugin few days back, that does the exact thing. You can try this too- https://wordpress.org/plugins/mask-comments/

Safe to remove this: when using a 3rd Party Comment App? [closed]

From the Disqus plugin core: // Only replace comments if the disqus_forum_url option is set. add_filter(‘comments_template’, ‘dsq_comments_template’); Which certainly implies that Disqus uses the <?php comments_template(); ?> include to include it’s own files, so I would advise leaving it where it is 🙂

Anonymize comments after one year

I don’t have a ready to use solution. Howeder I think is not to heavy to build a custom plugin, that do that. Update the comment data, use wp_update_comment(). For anonymize the IP you can use wp_privacy_anonymize_ip() (currently not in core, open as ticket). Use the wp cron to run this after 6 months and … Read more