Make WordPress Core

Changeset 46839


Ignore:
Timestamp:
12/09/2019 01:28:13 PM (7 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
branches/5.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/src/wp-login.php

    r46789 r46839  
    570570                }
    571571
     572                /**
     573                 * Filters the interval for dismissing the admin email confirmation screen.
     574                 *
     575                 * If `0` (zero) is returned, the "Remind me later" link will not be displayed.
     576                 *
     577                 * @since 5.3.1
     578                 *
     579                 * @param int $interval Interval time (in seconds). Default is 3 days.
     580                 */
     581                $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
     582
    572583                if ( ! empty( $_GET['remind_me_later'] ) ) {
    573584                        if ( ! wp_verify_nonce( $_GET['remind_me_later'], 'remind_me_later_nonce' ) ) {
     
    576587                        }
    577588
    578                         // "Remind me later" is a bit ambiguous. Three days later?
    579                         update_option( 'admin_email_lifespan', time() + 3 * DAY_IN_SECONDS );
     589                        if ( $remind_interval > 0 ) {
     590                                update_option( 'admin_email_lifespan', time() + $remind_interval );
     591                        }
    580592
    581593                        wp_safe_redirect( $redirect_to );
     
    591603                        /**
    592604                         * Filters the interval for redirecting the user to the admin email confirmation screen.
     605                         *
    593606                         * If `0` (zero) is returned, the user will not be redirected.
    594607                         *
    595608                         * @since 5.3.0
    596609                         *
    597                          * @param int Interval time (in seconds).
     610                         * @param int $interval Interval time (in seconds). Default is 6 months.
    598611                         */
    599612                        $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS );
     
    610623
    611624                /**
    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                 */
     625                 * Fires before the admin email confirm form.
     626                 *
     627                 * @since 5.3.0
     628                 *
     629                 * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid
     630                 *                         credentials. Note that the error object may not contain any errors.
     631                 */
    618632                do_action( 'admin_email_confirm', $errors );
    619633
     
    623637                        <?php
    624638                        /**
    625                         * Fires inside the admin-email-confirm-form form tags, before the hidden fields.
    626                         *
    627                         * @since 5.3.0
    628                         */
     639                         * Fires inside the admin-email-confirm-form form tags, before the hidden fields.
     640                         *
     641                         * @since 5.3.0
     642                         */
    629643                        do_action( 'admin_email_confirm_form' );
    630644
     
    682696                                        <input type="submit" name="correct-admin-email" id="correct-admin-email" class="button button-primary button-large" value="<?php esc_attr_e( 'The email is correct' ); ?>" />
    683697                                </div>
    684                                 <div class="admin-email__actions-secondary">
    685                                         <?php
    686 
    687                                         $remind_me_link = wp_login_url( $redirect_to );
    688                                         $remind_me_link = add_query_arg(
    689                                                 array(
    690                                                         'action'          => 'confirm_admin_email',
    691                                                         'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ),
    692                                                 ),
    693                                                 $remind_me_link
    694                                         );
    695 
    696                                         ?>
    697                                         <a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ); ?></a>
    698                                 </div>
     698                                <?php if ( $remind_interval > 0 ) : ?>
     699                                        <div class="admin-email__actions-secondary">
     700                                                <?php
     701
     702                                                $remind_me_link = wp_login_url( $redirect_to );
     703                                                $remind_me_link = add_query_arg(
     704                                                        array(
     705                                                                'action'          => 'confirm_admin_email',
     706                                                                'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ),
     707                                                        ),
     708                                                        $remind_me_link
     709                                                );
     710
     711                                                ?>
     712                                                <a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ); ?></a>
     713                                        </div>
     714                                <?php endif; ?>
    699715                        </div>
    700716                </form>
Note: See TracChangeset for help on using the changeset viewer.