Project

General

Profile

« Previous | Next » 

Revision 1815

Added by Dietmar almost 12 years ago

! Complex code refactoring users management

View differences:

upgrade-script.php
821 821

  
822 822
        foreach($aUsers AS $user_id => $value){
823 823
                // choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up)
824
                $groups_id = explode(',', $aUsers[$user_id]['groups_id']);
824
                $aGroups_id = explode(',', $aUsers[$user_id]['groups_id']);
825
                $groups_id = $aUsers[$user_id]['groups_id'];
825 826
                $group_id = 0;
826 827
                //if user is in administrator-group, get this group else just get the first one
827
                if($admin->is_group_match($groups_id,'1')) { $group_id = 1; } else { $group_id = intval($groups_id[0]); }
828
                unset($groups_id);
828
                if($admin->is_group_match($aGroups_id,'1')) { $group_id = 1; $groups_id = '1'; } else { $group_id = intval($aGroups_id[0]); }
829 829

  
830 830
                $sMessage = "<span>Updating group_id ".$TEXT['DISPLAY_NAME']." " .$aUsers[$user_id]['display_name']."</span>";
831 831
                $sql  = 'UPDATE `'.TABLE_PREFIX.'users` ';
832
                $sql .= 'SET `group_id` = '.$group_id.' ';
832
                $sql .= 'SET `group_id`  = '.$group_id.', ';
833
                $sql .=     '`groups_id` = '.$groups_id.' ';
833 834
                $sql .= 'WHERE `user_id` = '.intval($user_id);
834 835

  
835 836
                if($oRes = $database->query($sql)){  }

Also available in: Unified diff