Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ public static function handle_verify_email_change() {
\wc_add_notice( $error, 'error' );
}
} else {
\wc_add_notice( $error, 'error' );
\wc_add_notice( __( 'This email change request has been cancelled or expired.', 'newspack-plugin' ), 'error' );
}
\wp_safe_redirect( \wc_get_endpoint_url( 'edit-account', '', \wc_get_page_permalink( 'myaccount' ) ) );
exit;
Expand All @@ -982,7 +982,7 @@ public static function handle_cancel_email_change() {
\delete_user_meta( \get_current_user_id(), self::PENDING_EMAIL_CHANGE_META );
\wc_add_notice( __( 'Your email change request has been cancelled.', 'newspack-plugin' ) );
} else {
\wc_add_notice( __( 'Something went wrong.', 'newspack-plugin' ), 'error' );
\wc_add_notice( __( 'This email change request has been cancelled or expired.', 'newspack-plugin' ), 'error' );
}
\wp_safe_redirect( \wc_get_endpoint_url( 'edit-account', '', \wc_get_page_permalink( 'myaccount' ) ) );
exit;
Expand Down
19 changes: 18 additions & 1 deletion includes/reader-revenue/templates/myaccount-edit-account.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,26 @@ class="woocommerce-Input woocommerce-Input--text input-text"

<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide mt0">
<label for="account_email_display"><?php \esc_html_e( 'Email address', 'newspack-plugin' ); ?>
<?php if ( $is_email_change_enabled ) : ?>
<?php
if ( $is_email_change_enabled ) :
?>
<input type="email" class="woocommerce-Input woocommerce-Input--email input-text" name="newspack_account_email" id="newspack_account_email" autocomplete="email" <?php echo \esc_attr( $is_pending_email_change ? 'disabled' : '' ); ?> value="<?php echo \esc_attr( $display_email ); ?>" />
<input type="hidden" class="woocommerce-Input woocommerce-Input--email input-text" name="account_email" id="account_email" autocomplete="email" value="<?php echo \esc_attr( $user->user_email ); ?>" />
<?php if ( $is_pending_email_change ) : ?>
<span>
<em>
<?php
echo \wp_kses_post(
sprintf(
// Translators: %s is the account's current email address.
__( 'This email address is pending verification. Please verify to complete the change request, or cancel the change to retain the current account email: %s', 'newspack-plugin' ),
"<a href='mailto:$user->user_email'>$user->user_email</a>"
)
);
?>
</em>
</span>
<?php endif; ?>
<?php else : ?>
<input type="email" class="woocommerce-Input woocommerce-Input--email input-text" name="account_email_display" id="account_email_display" autocomplete="email" disabled value="<?php echo \esc_attr( $user->user_email ); ?>" />
<input type="hidden" class="woocommerce-Input woocommerce-Input--email input-text" name="account_email" id="account_email" autocomplete="email" value="<?php echo \esc_attr( $user->user_email ); ?>" />
Expand Down