Make WordPress Core

Changeset 48359


Ignore:
Timestamp:
07/07/2020 03:57:17 AM (6 years ago)
Author:
whyisjake
Message:

Site Health: Ensure that the user will be notified after a successful snooze action.

After clicking remind me later, the user is shown an admin notification.

Fixes #48333.

Props desrosj, sathyapulse, Clorith, azaozz, audrasjb, afragen, whyisjake.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/_index.php

    r47862 r48359  
    115115        <h1><?php echo esc_html( $title ); ?></h1>
    116116
     117        <?php
     118        if ( ! empty( $_GET['admin_email_remind_later'] ) ) :
     119                /** This filter is documented in wp-login.php */
     120                $remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
     121                $postponed_time  = get_option( 'admin_email_lifespan' );
     122
     123                /*
     124                 * Calculate how many seconds it's been since the reminder was postponed.
     125                 * This allows us to not show it if the query arg is set, but visited due to caches, bookmarks or similar.
     126                 */
     127                $time_passed = $postponed_time - $remind_interval - time();
     128
     129                // Only show the dashboard notice if it's been less than a minute since the message was postponed.
     130                if ( $time_passed > -60 ) :
     131                        ?>
     132                <div class="notice notice-success is-dismissible">
     133                        <p>
     134                                <?php
     135                                printf(
     136                                        /* translators: %1$s: The number of comments. %2$s: The post title. */
     137                                        _n( 'The admin email verification page will reappear after %d day.', 'The admin email verification page will reappear after %d days.', 3 ),
     138                                        number_format_i18n( 3 )
     139                                );
     140                                ?>
     141                        </p>
     142                </div>
     143                <?php endif; ?>
     144        <?php endif; ?>
     145
    117146<?php
    118147if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
  • trunk/src/wp-includes/functions.php

    r48327 r48359  
    11821182                'activate',
    11831183                'activated',
     1184                'admin_email_remind_later',
    11841185                'approved',
    11851186                'deactivate',
  • trunk/src/wp-login.php

    r48305 r48359  
    618618                        }
    619619
     620                        $redirect_to = add_query_arg( 'admin_email_remind_later', 1, $redirect_to );
    620621                        wp_safe_redirect( $redirect_to );
    621622                        exit;
Note: See TracChangeset for help on using the changeset viewer.