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…

Generate Email if No Posts Within Time Period

You’ll need to set up a cron job that checks once a day to see if the latest post is more than seven days old. So, some where in a plugin file. Schedule a new event. Then hook into that event. Grab the post date, turn it into a unix time stamp, and compare that … Read more

Remove field in the form : only works for “url”, not for “email”?

This works fine for me: <?php add_filter(‘comment_form_default_fields’, ‘wpse53687_filter_fields’); /** * Unsets the email field from the comment form. */ function wpse53687_filter_fields($fields) { if(isset($fields[’email’])) unset($fields[’email’]); return $fields; } One reason that it could be failing on your theme is that args were passed into comment_form. Specifically, the theme author passed in a fields key into the … Read more

I want to Add My Product Image to Admin Order Email in Woocommerece [closed]

The default admin email can be found in woocommerce/templates/emails/admin-new-order.php the order items table is called in line 28, with a function called email_order_items_table. This function also takes an argument for including the thumbnail (see the class-wc-order.php, line 1052). if you copy the email templates to your theme folder, you can edit the admin-new-order.php file and … Read more

Auto create file and send it via wp_mail()

Can’t help you with the creation of the .doc-file, as i have never done that. But if you manage to get the encoded file into a string, you can work with the WordPress PHP-Mailer instance like this: function send_my_mail_with_attachment($from,$to,$subject,$body,$attachmentstring=””){ global $phpmailer; // (Re)create it, if it’s gone missing if ( ! ( $phpmailer instanceof PHPMailer … Read more