-
Notifications
You must be signed in to change notification settings - Fork 19
[ENHANCEMENT] ADD V3.4+ Email Template Approach #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,158 @@ | ||||||||||||||
| <?php | ||||||||||||||
|
|
||||||||||||||
| class PMPro_Email_Template_Resend_Confirmation extends PMPro_Email_Template { | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * The parent user. | ||||||||||||||
| * | ||||||||||||||
| * @var WP_User | ||||||||||||||
| */ | ||||||||||||||
| protected $user; | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * The validation link. | ||||||||||||||
| * | ||||||||||||||
| * @var String | ||||||||||||||
| */ | ||||||||||||||
| protected $validation_link; | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Constructor. | ||||||||||||||
| * | ||||||||||||||
| * @since TBD | ||||||||||||||
| * | ||||||||||||||
| * @param WP_User $user The user will receive the email. | ||||||||||||||
|
||||||||||||||
| * @param WP_User $user The user will receive the email. | |
| * @param WP_User $user The user who will receive the email. |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These commented-out template variables are defined in get_email_template_variables() (lines 114-116) but not exposed in get_email_template_variables_with_description(). If these variables are not intended to be available for use in email templates, they should be removed from the method. If they should be available, uncomment and fix the grammar ('user need' should be 'user who needs').
| // '!!display_name!!' => esc_html__( 'The display name of the user need to confirm the email', 'pmpro-email-confirmation' ), | |
| // '!!user_login!!' => esc_html__( 'The login name of the user need to confirm the email', 'pmpro-email-confirmation' ), | |
| // '!!user_email!!' => esc_html__( 'The email address of the user need to confirm the email', 'pmpro-email-confirmation' ), | |
| '!!display_name!!' => esc_html__( 'The display name of the user who needs to confirm the email.', 'pmpro-email-confirmation' ), | |
| '!!user_login!!' => esc_html__( 'The login name of the user who needs to confirm the email.', 'pmpro-email-confirmation' ), | |
| '!!user_email!!' => esc_html__( 'The email address of the user who needs to confirm the email.', 'pmpro-email-confirmation' ), |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the empty line with trailing whitespace before the return statement.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,9 +23,14 @@ | |||||||||||||
| */ | ||||||||||||||
|
|
||||||||||||||
| function pmproec_load_plugin_text_domain() { | ||||||||||||||
| load_plugin_textdomain( 'pmpro-email-confirmation', false, basename( dirname( __FILE__ ) ) . '/languages' ); | ||||||||||||||
| load_plugin_textdomain( 'pmpro-email-confirmation', false, basename( dirname( __FILE__ ) ) . '/languages' ); | ||||||||||||||
| if ( class_exists( 'PMPro_Email_Template' ) ) { | ||||||||||||||
| include_once( dirname( __FILE__ ) . '/classes/email-templates/class-pmpro-email-template-pmpro-email-confirmation-resend-confirmation.php' ); | ||||||||||||||
| } else { | ||||||||||||||
| add_filter( 'pmproet_templates', 'pmproec_email_templates', 10, 1 ); | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
| add_action( 'init', 'pmproec_load_plugin_text_domain' ); | ||||||||||||||
| add_action( 'init', 'pmproec_load_plugin_text_domain', 8 ); | ||||||||||||||
|
|
||||||||||||||
| /* | ||||||||||||||
| Add checkbox to edit level page to set if level requires email confirmation. | ||||||||||||||
|
|
@@ -412,50 +417,56 @@ function pmproec_resend_confirmation_email( $user_id = NULL ) { | |||||||||||||
| return; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| $body = file_get_contents( dirname( __FILE__ ) . "/email/resend_confirmation.html" ); | ||||||||||||||
| $url = home_url( "?ui=" . $user->ID . "&validate=" . $validated ); | ||||||||||||||
|
|
||||||||||||||
| //filter to allow additional query arguments. | ||||||||||||||
| $pmpro_query_args = apply_filters( 'pmproec_query_args', array() ); | ||||||||||||||
|
|
||||||||||||||
| $url = home_url( "?ui=" . $user->ID . "&validate=" . $validated ); | ||||||||||||||
|
|
||||||||||||||
| //add query arguments to the URL (on top of existing args) | ||||||||||||||
| $url = ( add_query_arg( | ||||||||||||||
| $pmpro_query_args, | ||||||||||||||
| $url | ||||||||||||||
| )); | ||||||||||||||
| $url = ( add_query_arg( $pmpro_query_args, $url ) ); | ||||||||||||||
|
|
||||||||||||||
| if ( empty( $validated ) || $validated != "validated" ) { | ||||||||||||||
| //This is a flag to check if the email was sent successfully or not to show the success message. | ||||||||||||||
| $mail_sent_successfully = false; | ||||||||||||||
|
|
||||||||||||||
| //use validation_link substitute? | ||||||||||||||
| if ( false === stripos( $body, "!!validation_link!!" ) ) { | ||||||||||||||
| $body = "<p><strong>" . esc_html__("IMPORTANT! You must follow this link to confirm your email address before your membership is fully activated", "pmpro-email-confirmation") . ":<br /><a href='" . esc_url( $url ) . "'>" . esc_url( $url ) . "</a></strong></p><hr />" . $body; | ||||||||||||||
| } else { | ||||||||||||||
| $body = str_ireplace( "!!validation_link!!", $url, $body ); | ||||||||||||||
| if ( class_exists( 'PMPro_Email_Template' ) ) { | ||||||||||||||
| $send_resend_confirmation_email = new PMPro_Email_Template_Resend_Confirmation( $user, $url ); | ||||||||||||||
| $mail_sent_successfully = $send_resend_confirmation_email->send(); | ||||||||||||||
|
||||||||||||||
| $mail_sent_successfully = $send_resend_confirmation_email->send(); | |
| $mail_sent_successfully = $send_resend_confirmation_email->send(); | |
| if ( $mail_sent_successfully ) { | |
| $pmproec_msg = esc_html__( 'A confirmation email has been sent to', 'pmpro-email-confirmation' ) . ' ' . $user->user_email; | |
| $pmproec_msgt = 'updated'; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment 'The parent user' is unclear. This should be 'The user receiving the confirmation email' or simply 'The user' to better describe the property's purpose.