Ticket #48153: 48153.4.diff
File 48153.4.diff, 4.0 KB (added by , 5 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 * 594 * If `0` or a negative value is returned, the email verification screen will 595 * be shown again next time an administrator logs in. 594 596 * 595 597 * @since 5.3.0 596 598 * … … 598 600 */ 599 601 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); 600 602 601 if ( $admin_email_check_interval > 0 ) { 602 update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); 603 } 603 update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); 604 604 605 605 wp_safe_redirect( $redirect_to ); 606 606 exit; … … 609 609 login_header( __( 'Confirm your administration email' ), '', $errors ); 610 610 611 611 /** 612 * Fires before the admin email confirm form.613 *614 * @since 5.3.0615 *616 * @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.617 */612 * Fires before the admin email confirm form. 613 * 614 * @since 5.3.0 615 * 616 * @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. 617 */ 618 618 do_action( 'admin_email_confirm', $errors ); 619 619 620 620 ?> … … 622 622 <form class="admin-email-confirm-form" name="admin-email-confirm-form" action="<?php echo esc_url( site_url( 'wp-login.php?action=confirm_admin_email', 'login_post' ) ); ?>" method="post"> 623 623 <?php 624 624 /** 625 * Fires inside the admin-email-confirm-form form tags, before the hidden fields.626 *627 * @since 5.3.0628 */625 * Fires inside the admin-email-confirm-form form tags, before the hidden fields. 626 * 627 * @since 5.3.0 628 */ 629 629 do_action( 'admin_email_confirm_form' ); 630 630 631 631 wp_nonce_field( 'confirm_admin_email', 'confirm_admin_email_nonce' ); … … 1232 1232 exit; 1233 1233 } 1234 1234 1235 / **1236 * Filters the capability required for displaying the admin email check screen.1237 1238 * @since 5.3.01239 *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' );1243 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');1235 // Check if it is time to add a redirect to the admin email verification screen. 1236 if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) { 1237 /** 1238 * Filters whether the user should be redirected to the verification screen. Can also be used 1239 * to disable this functionality completely. 1240 * 1241 * @since 5.3.0 1242 * 1243 * @param bool True to redirect, false otherwise. 1244 * @param WP_User WP_User object. 1245 */ 1246 $show_verification = (bool) apply_filters( 'show_admin_email_verification', true, $user ); 1247 1247 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);1248 if ( $show_verification ) { 1249 $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); 1250 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 ) ); 1251 if ( time() > $admin_email_lifespan ) { 1252 $redirect_to = add_query_arg( 'action', 'confirm_admin_email', wp_login_url( $redirect_to ) ); 1253 } 1253 1254 } 1254 1255 } 1255 1256