From 0f26af82c03fe818fd5d891d4243ac460c954883 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 9 Dec 2019 13:28:13 +0000 Subject: [PATCH] Users: Introduce `admin_email_remind_interval` filter for dismissing the admin email confirmation screen. Props desrosj, birgire. Merges [46838], [46837] to the 5.3 branch. Fixes #48334. git-svn-id: https://develop.svn.wordpress.org/branches/5.3@46839 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-login.php | 68 ++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/src/wp-login.php b/src/wp-login.php index 8d95c7fb02..791ad418ba 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -569,14 +569,26 @@ switch ( $action ) { exit; } + /** + * Filters the interval for dismissing the admin email confirmation screen. + * + * If `0` (zero) is returned, the "Remind me later" link will not be displayed. + * + * @since 5.3.1 + * + * @param int $interval Interval time (in seconds). Default is 3 days. + */ + $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS ); + if ( ! empty( $_GET['remind_me_later'] ) ) { if ( ! wp_verify_nonce( $_GET['remind_me_later'], 'remind_me_later_nonce' ) ) { wp_safe_redirect( wp_login_url() ); exit; } - // "Remind me later" is a bit ambiguous. Three days later? - update_option( 'admin_email_lifespan', time() + 3 * DAY_IN_SECONDS ); + if ( $remind_interval > 0 ) { + update_option( 'admin_email_lifespan', time() + $remind_interval ); + } wp_safe_redirect( $redirect_to ); exit; @@ -590,11 +602,12 @@ switch ( $action ) { /** * Filters the interval for redirecting the user to the admin email confirmation screen. + * * If `0` (zero) is returned, the user will not be redirected. * * @since 5.3.0 * - * @param int Interval time (in seconds). + * @param int $interval Interval time (in seconds). Default is 6 months. */ $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); @@ -609,12 +622,13 @@ switch ( $action ) { login_header( __( 'Confirm your administration email' ), '', $errors ); /** - * Fires before the admin email confirm form. - * - * @since 5.3.0 - * - * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid credentials. Note that the error object may not contain any errors. - */ + * Fires before the admin email confirm form. + * + * @since 5.3.0 + * + * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid + * credentials. Note that the error object may not contain any errors. + */ do_action( 'admin_email_confirm', $errors ); ?> @@ -622,10 +636,10 @@ switch ( $action ) {
"> -
- 0 ) : ?> +
+ 'confirm_admin_email', - 'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ), - ), - $remind_me_link - ); + $remind_me_link = wp_login_url( $redirect_to ); + $remind_me_link = add_query_arg( + array( + 'action' => 'confirm_admin_email', + 'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ), + ), + $remind_me_link + ); - ?> - -
+ ?> + +
+