Last active
September 13, 2017 18:57
-
-
Save strangerstudios/7f7b5865e9ab7974e4e50b202cb0500b to your computer and use it in GitHub Desktop.
Have Paid Memberships Pro admin checkout emails come from the customer.
This file contains 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
/* | |
Have admin checkout emails come from the customer. | |
Add this code to a custom plugin. | |
*/ | |
function pmpro_email_filter_checkout_from_users($email) | |
{ | |
if(strpos($email->template, 'checkout') !== false) { | |
//get user info | |
$user = get_user_by('login', $email->data['user_login']); | |
//get from and from name. note that some SMTP servers (e.g. Google Mail) | |
//will ignore this and authmatically use the info from the Google account | |
$email->from = $user->user_email; | |
$email->fromname = $user->display_name; | |
//set reply to. even Google will set this | |
$email->headers[] = 'Reply-To: ' . $user->display_name . ' <' . $email->user_email . '>'; | |
} | |
return $email; | |
} | |
add_action('pmpro_email_filter', 'pmpro_email_filter_checkout_from_users'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment