Skip to content

Commit

Permalink
Resolved Issue ID 0000526:
Browse files Browse the repository at this point in the history
  o Add default group to new user




git-svn-id: http://piwigo.org/svn/trunk@1581 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
rub committed Oct 29, 2006
1 parent 2b3bc57 commit 2433a7c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/config_default.inc.php
Expand Up @@ -222,6 +222,9 @@
// 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 |
// +-----------------------------------------------------------------------+
Expand Down
20 changes: 20 additions & 0 deletions include/functions_user.inc.php
Expand Up @@ -93,6 +93,26 @@ function register_user($login, $password, $mail_address)
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);
}

Expand Down

0 comments on commit 2433a7c

Please sign in to comment.