Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ipokkel/3271235c1deb7920233f1905609b5faa to your computer and use it in GitHub Desktop.
Save ipokkel/3271235c1deb7920233f1905609b5faa 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 emails.
*
* 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 ( strpos( $email->template, 'checkout' ) === 0 && strpos( $email->template, 'admin' ) === false ) { // Add's password field to templates that start with checkout and don't contain admin.
$password = $_REQUEST['password'];
if ( ! empty( $password ) ) {
$body .= '<p>Your password is: ' . $password . '</p>';
}
};
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