From: Benjamin C. <bc...@us...> - 2002-03-30 20:37:53
|
Update of /cvsroot/phpbt/phpbt/admin In directory usw-pr-cvs1:/tmp/cvs-serv30065/admin Modified Files: user.php Log Message: Admin user preferences Index: user.php =================================================================== RCS file: /cvsroot/phpbt/phpbt/admin/user.php,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- user.php 30 Mar 2002 19:12:30 -0000 1.43 +++ user.php 30 Mar 2002 20:37:47 -0000 1.44 @@ -42,6 +42,7 @@ return; } if (!isset($_pv['factive'])) $_pv['factive'] = 0; + if (!isset($_pv['fe_notice'])) $_pv['fe_notice'] = 0; if (EMAIL_IS_LOGIN) { $login = $_pv['femail']; @@ -70,6 +71,10 @@ values ('$new_user_id' ,'$group', $u, $now)"); } } + // Add to prefs + $db->query("INSERT INTO ".TBL_USER_PREF." (user_id, email_notices) + VALUES ($new_user_id, '{$_pv['fe_notice']}')"); + // And add to the user group $db->query("insert into ".TBL_USER_GROUP. " (user_id, group_id, created_by, created_date) @@ -92,7 +97,11 @@ ", last_name = ".$db->quote(stripslashes($_pv['flastname'])). ", login = ".$db->quote(stripslashes($login)). ", email = '{$_pv['femail']}', $pquery active = {$_pv['factive']} ". - "where user_id = '$userid'"); + "where user_id = $userid"); + + // Update preferences + $db->query("update ".TBL_USER_PREF. + " set email_notices = {$_pv['fe_notice']} where user_id = $userid"); // Update group memberships // Get user's groups (without dropping the user group) @@ -132,7 +141,8 @@ if ($userid && !$error) { - $row = $db->getRow("select * from ".TBL_AUTH_USER." where user_id = '$userid'"); + $row = $db->getRow('select * from '.TBL_AUTH_USER." u, ". + TBL_USER_PREF." p where u.user_id = $userid and u.user_id = p.user_id"); // Get user's groups $user_groups = $db->getCol('select group_id from '.TBL_USER_GROUP. @@ -147,10 +157,11 @@ 'femail' => $row['email'], 'fpassword' => $row['password'], 'factive' => $row['active'] ? 'checked' : '', + 'fe_notice' => $row['email_notices'] ? 'checked' : '', 'fusergroup' => build_select('group', $user_groups), // Whether or not this user has admin rights 'hadadmin' => $db->getOne('select count(*) from '.TBL_USER_GROUP. - " where user_id = {$row['user_id']} and group_id = 1") + " where user_id = $userid and group_id = 1") )); } else { $t->set_var(array( @@ -166,6 +177,8 @@ 'fpassword' => isset($_pv['fpassword']) ? $_pv['fpassword'] : genpassword(10), 'factive' => isset($_pv['factive']) ? ($_pv['factive'] ? 'checked' : '') + : 'checked', + 'fe_notice' => isset($_pv['fe_notice']) ? ($_pv['fe_notice'] ? 'checked' : '') : 'checked', 'fusergroup' => build_select('group', (isset($_pv['fusergroup']) ? $_pv['fusergroup'] : array())), |