Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created September 21, 2017 11:53
Show Gist options
  • Save andrewlimaza/fd42df60db82d67e410421e6b8757171 to your computer and use it in GitHub Desktop.
Save andrewlimaza/fd42df60db82d67e410421e6b8757171 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_express' ){ //add's password field to certain template (PayPal Express), 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