Ticket #48153: 48153.3.diff
File 48153.3.diff, 2.8 KB (added by , 6 years ago) |
---|
-
src/wp-login.php
589 589 } 590 590 591 591 /** 592 * Filters the interval for redirecting the user to the admin email confirmation screen. 593 * If `0` (zero), or any "falsey" value is returned, the user will not be redirected. 592 * Filters the interval for redirecting the user to the admin email verification screen. 593 * If `0` or a negative value is returned, the email verification screen will 594 * be shown again next time an administrator logs in. 594 595 * 595 596 * @since 5.3.0 596 597 * … … 598 599 */ 599 600 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); 600 601 601 if ( $admin_email_check_interval > 0 ) { 602 update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); 603 } 602 update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); 604 603 605 604 wp_safe_redirect( $redirect_to ); 606 605 exit; … … 1232 1231 exit; 1233 1232 } 1234 1233 1235 /** 1236 * Filters the capability required for displaying the admin email check screen. 1237 * 1238 * @since 5.3.0 1239 * 1240 * @param string $capability The capability required to display the admin email check screen. 1241 */ 1242 $admin_check_cap = apply_filters( 'admin_email_check_cap', 'manage_options' ); 1234 // Check if it is time to add a redirect to the admin email verification screen. 1235 if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) { 1236 /** 1237 * Filters whether the user should be redirected to the verification screen. Can also be used 1238 * to disable this functionality completely. 1239 * 1240 * @since 5.3.0 1241 * 1242 * @param bool True to redirect, false otherwise. 1243 * @param WP_User WP_User object. 1244 */ 1245 $show_verification = (bool) apply_filters( 'show_admin_email_verification', true, $user ); 1243 1246 1244 // Check if it is time to add a redirect to the admin email confirmation screen. 1245 if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( $admin_check_cap ) ) { 1246 $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); 1247 if ( $show_verification ) { 1248 $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); 1247 1249 1248 /** This filter is documented in wp-login.php */ 1249 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); 1250 1251 if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) { 1252 $redirect_to = add_query_arg( 'action', 'confirm_admin_email', wp_login_url( $redirect_to ) ); 1250 if ( time() > $admin_email_lifespan ) { 1251 $redirect_to = add_query_arg( 'action', 'confirm_admin_email', wp_login_url( $redirect_to ) ); 1252 } 1253 1253 } 1254 1254 } 1255 1255