From 794d76c07470fa73be82f90fb774b439cd01ce4e Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Thu, 7 Apr 2022 23:14:52 +0000 Subject: [PATCH] Application Passwords: Use a more appropriate helper text message for super-admins. Previously, the helper text of the application password section was misleading for a Super Admin because an application password for a Super Admin grants access to all sites on the network, not just ones that they are a member of. This changeset provides a slightly different message for Super admin role. Props johnbillion, rsiddharth, audrasjb. Fixes #53234 git-svn-id: https://develop.svn.wordpress.org/trunk@53101 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/authorize-application.php | 20 ++++++++++++++------ src/wp-admin/user-edit.php | 20 ++++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/wp-admin/authorize-application.php b/src/wp-admin/authorize-application.php index d4104297ef..641721ebae 100644 --- a/src/wp-admin/authorize-application.php +++ b/src/wp-admin/authorize-application.php @@ -165,13 +165,21 @@ require_once ABSPATH . 'wp-admin/admin-header.php'; ?>

the %2$s site in this installation that you have permissions on.', - 'This will grant access to all %2$s sites in this installation that you have permissions on.', + /* translators: 1: URL to my-sites.php, 2: Number of sites the user has. */ + $msg_fmt = _n( + 'This will grant access to the %2$s site in this installation that you have permissions on.', + 'This will grant access to all %2$s sites in this installation that you have permissions on.', + $blogs_count + ); + if ( is_super_admin() ) { + $msg_fmt = _n( + 'This will grant access to the %2$s site on the network as you have Super Admin rights.', + 'This will grant access to all %2$s sites on the network as you have Super Admin rights.', $blogs_count - ), + ); + } + printf( + $msg_fmt, admin_url( 'my-sites.php' ), number_format_i18n( $blogs_count ) ); diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php index ad0da5c8f0..82a3db1bb1 100644 --- a/src/wp-admin/user-edit.php +++ b/src/wp-admin/user-edit.php @@ -746,13 +746,21 @@ switch ( $action ) { ?>

the %2$s site in this installation that you have permissions on.', - 'Application passwords grant access to all %2$s sites in this installation that you have permissions on.', + /* translators: 1: URL to my-sites.php, 2: Number of sites the user has. */ + $msg_fmt = _n( + 'Application passwords grant access to the %2$s site in this installation that you have permissions on.', + 'Application passwords grant access to all %2$s sites in this installation that you have permissions on.', + $blogs_count + ); + if ( is_super_admin( $user_id ) ) { + $msg_fmt = _n( + 'Application passwords grant access to the %2$s site on the network as you have Super Admin rights.', + 'Application passwords grant access to all %2$s sites on the network as you have Super Admin rights.', $blogs_count - ), + ); + } + printf( + $msg_fmt, admin_url( 'my-sites.php' ), number_format_i18n( $blogs_count ) );