From 0f99e345fab3347c2e33e3f9cec4f3ef92a9b5bd Mon Sep 17 00:00:00 2001 From: desrosj Date: Thu, 26 Sep 2019 15:41:57 +0000 Subject: [PATCH] Site Health: Allow the capability required for the site admin email verification screen to be filtered. Props desrosj, Clorith. Fixes #48153. Built from https://develop.svn.wordpress.org/trunk@46323 git-svn-id: http://core.svn.wordpress.org/trunk@46122 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-login.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 7a43b0f977..3d0fba761a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-beta1-46322'; +$wp_version = '5.3-beta1-46323'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-login.php b/wp-login.php index d51e556152..82aa83855e 100644 --- a/wp-login.php +++ b/wp-login.php @@ -1230,8 +1230,17 @@ switch ( $action ) { exit; } + /** + * Filters the capability required for displaying the admin email check screen. + * + * @since 5.3.0 + * + * @param string $capability The capability required to display the admn email check screen. + */ + $admin_check_cap = apply_filters( 'admin_email_check_cap', 'manage_options' ); + // Check if it is time to add a redirect to the admin email confirmation screen. - if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) { + if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( $admin_check_cap ) ) { $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); // If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected