Forked from femiyb/pmprosus_pmpro_email_data_edit.php
Last active
May 18, 2021 10:01
-
-
Save andrewlimaza/34d6a85eeff465f7d28f876d9ed20409 to your computer and use it in GitHub Desktop.
Edit Email Data for PMPro Signup Shortcode
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
<?php | |
/** | |
* Edit the Signup Shortcode password that is generated and emailed to the customer. | |
* Add this code to your site by following this guide: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
remove_filter('pmpro_email_data', 'pmprosus_pmpro_email_data', 10, 2); | |
function pmprosus_pmpro_email_data_edit($data, $email) { | |
if ( function_exists( 'pmpro_start_session' ) ) { | |
pmpro_start_session(); | |
} | |
// Include the generated password in the confirmation email. | |
if ( ! empty( $_SESSION['pmprosus_autogenerated_password'] ) && strpos( $email->template, 'checkout_' ) !== false ) { | |
$data['user_email'] = sprintf(__('Email: %s<br/> Password: %s', 'pmprosus'), $data['user_email'], $_SESSION['pmprosus_autogenerated_password'] ); | |
// Clear session variable | |
unset( $_SESSION['pmprosus_autogenerated_password'] ); | |
} | |
return $data; | |
} | |
add_filter('pmpro_email_data', 'pmprosus_pmpro_email_data_edit', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment