Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kimwhite/d092fe458cf46c540f4da935843852ca to your computer and use it in GitHub Desktop.
Save kimwhite/d092fe458cf46c540f4da935843852ca to your computer and use it in GitHub Desktop.
Add Password to checkout email for Paid Memberships Pro.
<?php
/**
* Add the user's password to the checkout email for PayPal Express.
* Please be sure to take proper precautions when dealing with user's passwords and sending out emails.
* This is for demonstrative purposes.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function add_password_to_pmpro_checkout_email( $body, $email ) {
if( $email->template == 'checkout_paid' ){ //add's password field to certain template (Checkout Paid), change template to corresponding template name.
$password = $_REQUEST['password'];
if( ! empty( $password ) ) {
$body .= 'Your password is: ' . $password;
}
};
return $body;
}
add_filter( "pmpro_email_body", "add_password_to_pmpro_checkout_email", 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment