From 102b92d9c33d1e7c950ee9a961c67b392338771b Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Fri, 21 Dec 2018 20:38:54 -0500 Subject: [PATCH 1/3] Wrap network check in admin check. --- modules/user-groups/user-groups.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/user-groups/user-groups.php b/modules/user-groups/user-groups.php index e85fa9ff6..418c37895 100644 --- a/modules/user-groups/user-groups.php +++ b/modules/user-groups/user-groups.php @@ -687,9 +687,13 @@ function user_profile_update( $errors, $update, $user ) { if ( !$update ) return array( &$errors, $update, &$user ); - //Don't allow update of user groups from network - if ( ( !is_null( get_current_screen() ) ) && ( get_current_screen()->is_network ) ) - return; + // `get_current_screen()` is defined on most admin pages, but not all. + if( is_admin() && function_exists( 'get_current_screen' ) ){ + //Don't allow update of user groups from network + if ( ( !is_null( get_current_screen() ) ) && ( get_current_screen()->is_network ) ) { + return; + } + } if ( current_user_can( $this->manage_usergroups_cap ) && wp_verify_nonce( $_POST['ef_edit_profile_usergroups_nonce'], 'ef_edit_profile_usergroups_nonce' ) ) { // Sanitize the data and save From d68349193be8038d6aec9960b5e3e2a64ff75b29 Mon Sep 17 00:00:00 2001 From: "Kyle B. Johnson" Date: Fri, 11 Jan 2019 08:57:04 -0500 Subject: [PATCH 2/3] Remove redundent is_admin() check. --- modules/user-groups/user-groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/user-groups/user-groups.php b/modules/user-groups/user-groups.php index 418c37895..13ac79971 100644 --- a/modules/user-groups/user-groups.php +++ b/modules/user-groups/user-groups.php @@ -688,7 +688,7 @@ function user_profile_update( $errors, $update, $user ) { return array( &$errors, $update, &$user ); // `get_current_screen()` is defined on most admin pages, but not all. - if( is_admin() && function_exists( 'get_current_screen' ) ){ + if( function_exists( 'get_current_screen' ) ){ //Don't allow update of user groups from network if ( ( !is_null( get_current_screen() ) ) && ( get_current_screen()->is_network ) ) { return; From cc385c7306e458303480993902dfceec8099d281 Mon Sep 17 00:00:00 2001 From: Daryl Chymko Date: Thu, 31 Oct 2019 14:12:39 -0700 Subject: [PATCH 3/3] Update modules/user-groups/user-groups.php Co-Authored-By: Mohammad Jangda --- modules/user-groups/user-groups.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/user-groups/user-groups.php b/modules/user-groups/user-groups.php index 66d9f99c2..1c81ddda4 100644 --- a/modules/user-groups/user-groups.php +++ b/modules/user-groups/user-groups.php @@ -690,7 +690,8 @@ function user_profile_update( $errors, $update, $user ) { // `get_current_screen()` is defined on most admin pages, but not all. if( function_exists( 'get_current_screen' ) ){ //Don't allow update of user groups from network - if ( ( !is_null( get_current_screen() ) ) && ( get_current_screen()->is_network ) ) { + $screen = get_current_screen(); + if ( ! is_null( $screen ) && $screen->is_network ) { return; } }