Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@
->set_help_text( esc_html__( 'Hide this profile from members. Overrides the global profile options.', 'wp-user-manager' ) ),
);

if ( $allow_multiple_roles && ( $profileuser || 'user-new.php' === $pagenow ) && ! is_network_admin() ) {
if ( $allow_multiple_roles && ( $profileuser || in_array( $pagenow, array( 'user-new.php', 'user-edit.php' ) ) ) && ! is_network_admin() ) {

Check warning on line 521 in includes/actions.php

View workflow job for this annotation

GitHub Actions / phpcs

Not using strict comparison for in_array; supply true for third argument.
Copy link

Copilot AI Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the strict parameter in in_array (e.g., in_array($pagenow, ['user-new.php', 'user-edit.php'], true)) to ensure type-safe comparisons.

Suggested change
if ( $allow_multiple_roles && ( $profileuser || in_array( $pagenow, array( 'user-new.php', 'user-edit.php' ) ) ) && ! is_network_admin() ) {
if ( $allow_multiple_roles && ( $profileuser || in_array( $pagenow, array( 'user-new.php', 'user-edit.php' ), true ) ) && ! is_network_admin() ) {

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Extract the array of page names into a descriptive variable or constant (e.g., $role_pages = ['user-new.php', 'user-edit.php'];) to improve readability and simplify future updates.

Suggested change
if ( $allow_multiple_roles && ( $profileuser || in_array( $pagenow, array( 'user-new.php', 'user-edit.php' ) ) ) && ! is_network_admin() ) {
$role_pages = array( 'user-new.php', 'user-edit.php' );
if ( $allow_multiple_roles && ( $profileuser || in_array( $pagenow, $role_pages ) ) && ! is_network_admin() ) {

Copilot uses AI. Check for mistakes.
$fields[] = Field::make( 'multiselect', 'wpum_user_roles', '' )
->add_options( $roles )
->set_default_value( $existing_roles )
Expand Down
Loading