This commit is contained in:
Javier Casares 2026-11-04 14:37:18 +00:00
commit 7379505d20

View file

@ -431,8 +431,13 @@ class Settings_Page {
</thead>
<tbody>
<?php foreach ( $roles as $role_key => $role_details ) : ?>
<?php
$role_name = isset( $role_details['name'] ) && is_string( $role_details['name'] )
? $role_details['name']
: $role_key;
?>
<tr data-2fa-role="<?php echo esc_attr( $role_key ); ?>">
<td><?php echo esc_html( translate_user_role( $role_details['name'] ) ); ?></td>
<td><?php echo esc_html( translate_user_role( $role_name ) ); ?></td>
<?php foreach ( $methods as $method_key => $method_label ) : ?>
<td style="text-align:center;">
<label>
@ -441,7 +446,7 @@ class Settings_Page {
printf(
/* translators: 1: role name, 2: method name. */
esc_html__( '%1$s: require %2$s', 'robotstxt-2fa' ),
esc_html( translate_user_role( $role_details['name'] ) ),
esc_html( translate_user_role( $role_name ) ),
esc_html( $method_label )
);
?>
@ -802,7 +807,7 @@ class Settings_Page {
/**
* Resolve role_methods from stored options, migrating legacy force_roles + default_method if needed.
*
* @param array<string, mixed> $options Raw stored options.
* @param array<mixed> $options Raw stored options (untyped values from the options table).
*
* @return array<string, array<int, string>>
*/
@ -1145,7 +1150,7 @@ class Settings_Page {
$capability,
self::PAGE_SLUG,
array( $this, 'render_page' ),
'dashicons-shield'
Dashboard_Page::MENU_ICON
);
// Rename the first auto-created submenu entry to "Settings".