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
This commit is contained in:
Jb Audras 2022-04-07 23:14:52 +00:00
parent a43a096883
commit 794d76c074
2 changed files with 28 additions and 12 deletions

View File

@ -165,13 +165,21 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<p>
<?php
printf(
/* translators: 1: URL to my-sites.php, 2: Number of sites the user has. */
_n(
'This will grant access to <a href="%1$s">the %2$s site in this installation that you have permissions on</a>.',
'This will grant access to <a href="%1$s">all %2$s sites in this installation that you have permissions on</a>.',
/* translators: 1: URL to my-sites.php, 2: Number of sites the user has. */
$msg_fmt = _n(
'This will grant access to <a href="%1$s">the %2$s site in this installation that you have permissions on</a>.',
'This will grant access to <a href="%1$s">all %2$s sites in this installation that you have permissions on</a>.',
$blogs_count
);
if ( is_super_admin() ) {
$msg_fmt = _n(
'This will grant access to <a href="%1$s">the %2$s site on the network as you have Super Admin rights</a>.',
'This will grant access to <a href="%1$s">all %2$s sites on the network as you have Super Admin rights</a>.',
$blogs_count
),
);
}
printf(
$msg_fmt,
admin_url( 'my-sites.php' ),
number_format_i18n( $blogs_count )
);

View File

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