Forked from JarrydLong/mypmpro-different-email-per-level-approved.php
Last active
December 20, 2023 20:11
-
-
Save kimwhite/344a83e3f3e25509984ca3317d6ac628 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //do not copy | |
/** | |
* This recipe sends a different 'Application Approved' email when approving a member | |
* in the Approvals Add On based on their level. | |
* | |
* Does not support email templates at this point in time. Subject & Body should be updated in the code below. | |
* | |
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Works for PayPal Express and Stripe payment gateways. | |
* www.paidmembershipspro.com | |
*/ | |
function my_pmpro_email_filter( $email ){ | |
if($email->template == 'application_approved'){ | |
if($email->data['membership_id'] == 1 ){ | |
$email->subject = 'Your Membership 1 Has Been Approved'; | |
$email->body = 'This is the content/body of the email for members who are approved for level 1'; | |
} | |
if($email->data['membership_id'] == 2 ){ | |
$email->subject = 'Your Membership 2 Has Been Approved'; | |
$email->body = 'This is the content/body of the email for members who are approved for level 2'; | |
} | |
if($email->data['membership_id'] == 4 ){ | |
$email->subject = 'Your Membership 4 Has Been Approved'; | |
$email->body = 'Dear ' . $email->data["display_name"] .',<br><br> your (Senior Executive) membership account at The Black Music Coalition has been approved. Please click the below to pay our Senior Executive subscription of £70 per annum. <br><br> <a href="https://blackmusiccoalition.co.uk/membership-account/membership-checkout/?level=4">Pay Now</a>'; | |
} | |
} | |
return $email; | |
} | |
add_filter('pmpro_email_filter', 'my_pmpro_email_filter', 99, 1); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment