Forked from kimwhite/add_password_to_pmpro_checkout_email.php
Last active
May 7, 2025 07:50
-
-
Save ipokkel/3271235c1deb7920233f1905609b5faa to your computer and use it in GitHub Desktop.
Add Password to checkout email for Paid Memberships Pro.
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 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