mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-18 23:53:39 +02:00
Resolved Issue ID 0000526:
o Add default group to new user Allow to have n default groups. Property are save on table #_group and can be modified on administration group screen. git-svn-id: http://piwigo.org/svn/trunk@1583 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user