diff options
Diffstat (limited to '')
-rw-r--r-- | include/config_default.inc.php | 3 | ||||
-rw-r--r-- | include/functions_user.inc.php | 31 |
2 files changed, 21 insertions, 13 deletions
diff --git a/include/config_default.inc.php b/include/config_default.inc.php index a27b604e6..b70b24e21 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -222,9 +222,6 @@ $conf['check_upgrade_feed'] = true; // rate_items: available rates for a picture $conf['rate_items'] = array(0,1,2,3,4,5); -// Dafault groups to assign to new user -$conf['default_group_id'] = -1; - // +-----------------------------------------------------------------------+ // | metadata | // +-----------------------------------------------------------------------+ diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index a599539e8..3cdae176e 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -93,23 +93,34 @@ SELECT MAX('.$conf['user_fields']['id'].') + 1 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); mass_inserts(USERS_TABLE, array_keys($insert), array($insert)); - // Assign by default one group - if(isset($conf['default_group_id'])) + // Assign by default groups { $query = ' -select count(*) from '.GROUPS_TABLE.' where id = '.$conf['default_group_id'].';'; - list($exist_group) = mysql_fetch_array(pwg_query($query)); +SELECT id + FROM '.GROUPS_TABLE.' + WHERE is_default = \''.boolean_to_string(true).'\' + ORDER BY id ASC +;'; + $result = pwg_query($query); - if ($exist_group == 1) + $inserts = array(); + while ($row = mysql_fetch_array($result)) { - $insert = - array( + array_push + ( + $inserts, + array + ( 'user_id' => $next_id, - 'group_id' => $conf['default_group_id'] - ); + 'group_id' => $row['id'] + ) + ); + } + if (count($inserts) != 0) + { include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); - mass_inserts(USER_GROUP_TABLE, array_keys($insert), array($insert)); + mass_inserts(USER_GROUP_TABLE, array('user_id', 'group_id'), $inserts); } } |