-
-
Save dwanjuki/1cf990b7dd23f7ac742eef369dc785fc to your computer and use it in GitHub Desktop.
Send a custom email to user after the user's email is validated
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 | |
*/ | |
function my_send_email_after_validation( $user_id ){ | |
$user_details = get_userdata( $user_id ); //get validated user's data | |
$my_email = new PMProEmail(); | |
$my_email->email = $user_details->user_email; // send to the validated email address | |
$my_email->subject = 'Thank you for validating your email address!'; // Set email subject line here | |
$my_email->template = 'My Post Validation Email'; // custom name of email template. | |
$my_email->body = '<p>Hi there,</p>'; // header of body content goes here | |
$my_email->body .= '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>'; // body content goes here. | |
$my_email->body .= '<p>Best Regards,</p> My Site Name.'; // footer content goes here. | |
$my_email->sendEmail(); | |
} | |
add_action( 'pmproec_after_validate_user', 'my_send_email_after_validation', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment