This filter is run after the plugin makes the decision of adding (or not adding) email to the queue. This is the final step before the email is added (or not) to the queue. This takes into account the main add to Queue option in plugin settings and the email eligibility based on the plugin settings.

This filter provides 3 arguments.

Arguments

  • $add: value can be true or false, and it is determined for each email based on the plugin settings.
  • $email: object holding the mirror of all the PHPMailer settings relevant to each email.
  • $type: email type detected by the plugin.

Email Types

Here is the list of all available email types as of version 2.2:

  • wp_comment_notify_moderator
  • wp_email_change_confirmation
  • wp_email_change_notification
  • wp_password_change_notification
  • wpmu_signup_blog_confirmation
  • wpmu_signup_user_confirmation
  • wp_privacy_request_confirmation
  • wp_privacy_erasure_fulfillment
  • wp_send_user_request
  • wp_site_admin_email_change
  • wp_new_user_notification_admin
  • wp_new_user_notification
  • wp_password_change_notification_admin
  • wp_recovery_mode_email
  • wpmu_welcome_blog
  • wpmu_welcome_user
  • wpmu_new_blog_siteadmin
  • wpmu_new_user_siteadmin
  • wpmu_network_admin_email_confirmation
  • wpmu_network_admin_email_notification
  • bbpress_new_reply_in_topic
  • bbpress_new_topic_in_forum
  • bbpress_topic_auto_close
  • bbpress_topic_manual_close
  • bbpress_topic_edit
  • bbpress_reply_edit
  • bbpress_new_topic_moderators

And, there are more types for BuddyPress, and they have names prefixed with ‘buddypress_’.

Example

Here is the example that will skip the queue based on the email type.

add_filter('gdmaq_mailer_add_to_queue', 'custom__gdmaq_mailer_add_to_queue', 10, 3);
function custom__gdmaq_mailer_add_to_queue($add, $email, $type) {
  $dont_add = array('wp_password_change_notification', 'wpmu_signup_user_confirmation', 'wp_email_change_confirmation');
  if (in_array($type, $dont_add)) {
    $add = false;
  }

  return $add;
}

 

0
0
23
Rate this reference

You are not allowed to rate this post.

Comments

Leave a Reply