File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -727,21 +727,24 @@ private function save_users()
727727 unset($ sql_ary );
728728
729729 // Put them in groups.
730- $ chunk_cnt = 0 ;
730+ $ chunk_cnt = $ skip = 0 ;
731731
732- // This is to skip adding mods and admins to the newly registered user group
733- $ managers = array_intersect ($ user_groups , ['ADMINISTRATORS ' , 'GLOBAL_MODERATORS ' ]);
732+ // Don't add the first users to the newly registered group if a moderator and/or an admin is needed.
733+ $ skip = ($ this ->create_mod ) ? $ skip + 1 : $ skip ;
734+ $ skip = ($ this ->create_admin ) ? $ skip + 1 : $ skip ;
734735
735736 // First the registered group.
736737 foreach ($ this ->user_arr as $ user )
737738 {
738739 $ sql_ary [] = array (
739740 'user_id ' => (int ) $ user ['user_id ' ],
740- 'group_id ' => $ this ->num_new_group && $ user ['user_posts ' ] < 1 && ! array_key_exists ( $ user [ ' group_id ' ], $ managers ) ? $ newly_registered_group : $ registered_group ,
741+ 'group_id ' => $ this ->num_new_group && $ user ['user_posts ' ] < 1 && $ skip < 1 ? $ newly_registered_group : $ registered_group ,
741742 'group_leader ' => 0 , // No group leaders.
742743 'user_pending ' => 0 , // User is not pending.
743744 );
744745
746+ $ skip --;
747+
745748 if ($ s_chunks && $ chunk_cnt >= $ this ->user_chunks )
746749 {
747750 // throw the array to the users table
You can’t perform that action at this time.
0 commit comments