Primary Role empty while grant role
-
Hey,
In Users page, Grant role functionality has issue.
If I am Super admin in multisite and I am trying to assign additional role to more than one user without selecting primary role, it set all selected user with empty primary role. This is unexpected behaviour.
Instead of this is should display error.$lib = URE_Lib::get_instance(); $select_primary_role = apply_filters('ure_users_select_primary_role', true); if ($select_primary_role || $lib->is_super_admin()) { foreach ($users as $user_id) { self::grant_primary_role_to_user($user_id, $primary_role); } if (empty($primary_role)) { // users don't have primary role, so they should not have any other roles - stop processing $answer = array('result'=>'success', 'message'=>esc_html__('Users does not have role for this site', 'user-role-editor')); return; } }
Bug: In above code primary role value check after assign user primary role, and instead of error (.$answer ) it simply return empty
We should check primary role variable is empty or not before set user primary role
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Primary Role empty while grant role’ is closed to new replies.