Created
September 10, 2019 19:42
-
-
Save femiyb/c0969215bc3a8245bf3022efc6aef631 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 | |
/** | |
* Add this code to your PMPro Customizations Plugin - http://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* This function below sends a custom HTML email to the user that checks out for a pmpro membership level, easily extendible to send to admins, or specific users and so on. | |
* Website: https://paidmembershipspro.com | |
*/ | |
//this gist will send a custom email when a new member is added using the add member add on | |
function custom_email_after_checkout( $user_id, $morder ){ | |
$user_details = get_userdata( $user_id ); //get user data for user checking out. | |
$my_email = new PMProEmail(); | |
$my_email->email = $user_details->user_email; //who to send the email to - send to user that is checking out. | |
$my_email->subject = 'This is a custom subject header'; //change this to the header you would like to use. | |
$my_email->template = 'My Custom Email'; //custom name of email template. | |
$my_email->body = '<p>Hi there,</p>'; //header of body content goes here | |
$my_email->body .= '<p>Thank you for your purchase. {Change this text} </p>'; //body content goes here. | |
$my_email->body .= '<p>Best Regards,</p> My Site Name.'; //footer content goes here. | |
$my_email->sendEmail(); | |
} | |
add_action( 'pmpro_add_member_added', 'custom_email_after_checkout', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment