aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2006-10-29 10:36:54 +0000
committerrub <rub@piwigo.org>2006-10-29 10:36:54 +0000
commit2433a7cb54c024e8142ad81d182440ff692e377b (patch)
tree5cf15b8eb42be78e90b53ab27904ec43f4295135 /include
parent2b3bc579e4dcd4bf64c712eeca86f05e2d70fbf0 (diff)
Resolved Issue ID 0000526:
o Add default group to new user git-svn-id: http://piwigo.org/svn/trunk@1581 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/config_default.inc.php3
-rw-r--r--include/functions_user.inc.php20
2 files changed, 23 insertions, 0 deletions
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index b70b24e21..657c0c0e2 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -222,6 +222,9 @@ $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['id_group'] = 1;
+
// +-----------------------------------------------------------------------+
// | metadata |
// +-----------------------------------------------------------------------+
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index dac173f3e..6db576609 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -93,6 +93,26 @@ 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['id_group']))
+ {
+ $query = '
+select count(*) from '.GROUPS_TABLE.' where id = '.$conf['id_group'].';';
+ list($exist_group) = mysql_fetch_array(pwg_query($query));
+
+ if ($exist_group == 1)
+ {
+ $insert =
+ array(
+ 'user_id' => $next_id,
+ 'group_id' => $conf['id_group']
+ );
+
+ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
+ mass_inserts(USER_GROUP_TABLE, array_keys($insert), array($insert));
+ }
+ }
+
create_user_infos($next_id);
}