Skip to content

Commit

Permalink
Site Health: Ensure that the user will be notified after a successful…
Browse files Browse the repository at this point in the history
… snooze action.

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

Fixes #48333.

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


git-svn-id: https://develop.svn.wordpress.org/trunk@48359 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
whyisjake committed Jul 7, 2020
1 parent 0dcbb5b commit f86dd5c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/wp-admin/_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,35 @@
<div class="wrap">
<h1><?php echo esc_html( $title ); ?></h1>

<?php
if ( ! empty( $_GET['admin_email_remind_later'] ) ) :
/** This filter is documented in wp-login.php */
$remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS );
$postponed_time = get_option( 'admin_email_lifespan' );

/*
* Calculate how many seconds it's been since the reminder was postponed.
* This allows us to not show it if the query arg is set, but visited due to caches, bookmarks or similar.
*/
$time_passed = $postponed_time - $remind_interval - time();

// Only show the dashboard notice if it's been less than a minute since the message was postponed.
if ( $time_passed > -60 ) :
?>
<div class="notice notice-success is-dismissible">
<p>
<?php
printf(
/* translators: %1$s: The number of comments. %2$s: The post title. */
_n( 'The admin email verification page will reappear after %d day.', 'The admin email verification page will reappear after %d days.', 3 ),
number_format_i18n( 3 )
);
?>
</p>
</div>
<?php endif; ?>
<?php endif; ?>

<?php
if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
$classes = 'welcome-panel';
Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,7 @@ function wp_removable_query_args() {
$removable_query_args = array(
'activate',
'activated',
'admin_email_remind_later',
'approved',
'deactivate',
'delete_count',
Expand Down
1 change: 1 addition & 0 deletions src/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ function retrieve_password() {
update_option( 'admin_email_lifespan', time() + $remind_interval );
}

$redirect_to = add_query_arg( 'admin_email_remind_later', 1, $redirect_to );
wp_safe_redirect( $redirect_to );
exit;
}
Expand Down

0 comments on commit f86dd5c

Please sign in to comment.