Skip to content

Instantly share code, notes, and snippets.

@pingram3541
Created January 30, 2017 21:06
Show Gist options
  • Save pingram3541/2d56da070e2370ab2f1e31af89232c76 to your computer and use it in GitHub Desktop.
Save pingram3541/2d56da070e2370ab2f1e31af89232c76 to your computer and use it in GitHub Desktop.
PMPro filter emails
/*********************************************
* OVERRIDE - Disable initial "new content" outgoing email
*
* Members have access to intial drip content, the disables the intial "you have new content" email
* *******************************************/
function gfc_pmpro_email_filter($email) {
//Only continue for "new_content" template emails.
if($email->template != 'new_content')
return $email;
/* code marked out below only sends new series if
* they have been a member longer than 25=4 hours
* however we are using MailChimp for all of these
* emails so we are marking it out for now.
***************************************************/
/*$user = get_user_by('email', $email->email);
$level = pmpro_getMembershipLevelForUser($user->ID);
// Don't send the email if the user's membership started in the last 24 hours.
if(strtotime('+24 hours', $level->startdate) > current_time('timestamp'))
return false;
return $email;*/
return NULL;
}
add_filter('pmpro_email_filter', 'gfc_pmpro_email_filter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment