Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created September 4, 2014 17:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save strangerstudios/c4e771dca8723613bce3 to your computer and use it in GitHub Desktop.
Save strangerstudios/c4e771dca8723613bce3 to your computer and use it in GitHub Desktop.
Add an attachment to confirmation emails in Paid Memberships Pro
/*
Add an attachment to confirmation emails.
Requires PMPro v1.7.14+
*/
function my_pmpro_email_attachments($attachments, $email)
{
//make sure it's a checkout email (but not the admin one)
if(strpos($email->template, "checkout_") !== false && strpos($email->template, "admin") === false)
{
//make sure attachments is an array
if(is_array($attachments))
$attachments = array();
//add our attachment
$attachments[] = ABSPATH . "/wp-content/uploads/2014/09/Picture1.jpg";
}
return $attachments;
}
add_filter('pmpro_email_attachments', 'my_pmpro_email_attachments', 10, 2);
@GaddMaster
Copy link

Were do we leave this exactly, the code or file. When my users subscribe by check, and get email, i want them to get this too. A attachment. Waiting ages get help from premium support . Thanks

@andrewlimaza
Copy link

This may be added to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/

@cremigerhonig
Copy link

any other attachment will be deleted if you use above code, you can change like this:

change this:

if(is_array($attachments))

into this:
if(!is_array($attachments))

so it wont delete your other attachments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment