mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
put user into appropiate group after activating his account
git-svn-id: file:///svn/phpbb/trunk@5086 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
da674eae0c
commit
9c2cde7dfd
5 changed files with 49 additions and 44 deletions
|
@ -249,10 +249,20 @@ function user_active_flip($user_id, $user_type, $user_actkey = false, $username
|
|||
AND group_id = " . $group_id_ary[$group_name];
|
||||
$db->sql_query($sql);
|
||||
|
||||
$sql_update = ($group_id == $group_id_ary[$group_name]) ? ", group_id = $new_group_id" : '';
|
||||
$sql_update .= ($user_actkey) ? ", user_actkey = '$user_actkey'" : '';
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_type = ' . (($user_type == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL) . "$sql_update
|
||||
$sql_ary = array(
|
||||
'user_type' => ($user_type == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL
|
||||
);
|
||||
|
||||
if ($group_id == $group_id_ary[$group_name])
|
||||
{
|
||||
$sql_ary['group_id'] = $new_group_id;
|
||||
}
|
||||
|
||||
if ($user_actkey !== false)
|
||||
{
|
||||
$sql_ary['user_actkey'] = $user_actkey;
|
||||
}
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE user_id = $user_id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
|
|
|
@ -44,22 +44,28 @@ class ucp_activate extends module
|
|||
|
||||
$update_password = ($row['user_newpasswd']) ? true : false;
|
||||
|
||||
$sql_ary = array(
|
||||
'user_type' => USER_NORMAL,
|
||||
'user_actkey' => ''
|
||||
);
|
||||
|
||||
if ($update_password)
|
||||
{
|
||||
$sql_ary += array(
|
||||
$sql_ary = array(
|
||||
'user_type' => USER_NORMAL,
|
||||
'user_actkey' => '',
|
||||
'user_password' => $row['user_newpasswd'],
|
||||
'user_newpasswd' => ''
|
||||
);
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . $row['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||
WHERE user_id = ' . $row['user_id'];
|
||||
$result = $db->sql_query($sql);
|
||||
// TODO: check for group membership after password update... active_flip there too
|
||||
if (!$update_password)
|
||||
{
|
||||
// Now we need to demote the user from the inactive group and add him to the registered group
|
||||
|
||||
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||
user_active_flip($row['user_id'], $row['user_type'], '', $row['username']);
|
||||
}
|
||||
|
||||
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
|
||||
{
|
||||
|
|
|
@ -59,11 +59,11 @@ class ucp_register extends module
|
|||
'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday),
|
||||
'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday),
|
||||
|
||||
'U_COPPA_NO' => "ucp.$phpEx$SID&mode=register&coppa=0",
|
||||
'U_COPPA_YES' => "ucp.$phpEx$SID&mode=register&coppa=1",
|
||||
'U_COPPA_NO' => "{$phpbb_root_path}ucp.$phpEx$SID&mode=register&coppa=0",
|
||||
'U_COPPA_YES' => "{$phpbb_root_path}ucp.$phpEx$SID&mode=register&coppa=1",
|
||||
|
||||
'S_SHOW_COPPA' => true,
|
||||
'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register")
|
||||
'S_REGISTER_ACTION' => "{$phpbb_root_path}ucp.$phpEx$SID&mode=register")
|
||||
);
|
||||
}
|
||||
else
|
||||
|
@ -72,28 +72,28 @@ class ucp_register extends module
|
|||
'L_AGREEMENT' => $user->lang['UCP_AGREEMENT'],
|
||||
|
||||
'S_SHOW_COPPA' => false,
|
||||
'S_REGISTER_ACTION' => "ucp.$phpEx$SID&mode=register")
|
||||
'S_REGISTER_ACTION' => "{$phpbb_root_path}ucp.$phpEx$SID&mode=register")
|
||||
);
|
||||
}
|
||||
|
||||
$this->display($user->lang['REGISTER'], 'ucp_agreement.html');
|
||||
}
|
||||
|
||||
$var_ary = array(
|
||||
'username' => (string) '',
|
||||
'password_confirm' => (string) '',
|
||||
'new_password' => (string) '',
|
||||
'cur_password' => (string) '',
|
||||
'email' => (string) '',
|
||||
'email_confirm' => (string) '',
|
||||
'confirm_code' => (string) '',
|
||||
'lang' => (string) $config['default_lang'],
|
||||
'tz' => (float) $config['board_timezone'],
|
||||
);
|
||||
|
||||
// If we change the language inline, we do not want to display errors, but pre-fill already filled out values
|
||||
if ($change_lang)
|
||||
{
|
||||
$var_ary = array(
|
||||
'username' => (string) '',
|
||||
'password_confirm' => (string) '',
|
||||
'new_password' => (string) '',
|
||||
'cur_password' => (string) '',
|
||||
'email' => (string) '',
|
||||
'email_confirm' => (string) '',
|
||||
'confirm_code' => (string) '',
|
||||
'lang' => (string) $config['default_lang'],
|
||||
'tz' => (float) $config['board_timezone'],
|
||||
);
|
||||
|
||||
foreach ($var_ary as $var => $default)
|
||||
{
|
||||
$$var = request_var($var, $default);
|
||||
|
@ -103,18 +103,6 @@ class ucp_register extends module
|
|||
// Check and initialize some variables if needed
|
||||
if ($submit)
|
||||
{
|
||||
$var_ary = array(
|
||||
'username' => (string) '',
|
||||
'password_confirm' => (string) '',
|
||||
'new_password' => (string) '',
|
||||
'cur_password' => (string) '',
|
||||
'email' => (string) '',
|
||||
'email_confirm' => (string) '',
|
||||
'confirm_code' => (string) '',
|
||||
'lang' => (string) $config['default_lang'],
|
||||
'tz' => (float) $config['board_timezone'],
|
||||
);
|
||||
|
||||
foreach ($var_ary as $var => $default)
|
||||
{
|
||||
$data[$var] = request_var($var, $default);
|
||||
|
@ -369,11 +357,11 @@ class ucp_register extends module
|
|||
}
|
||||
}
|
||||
|
||||
if ($config['require_activation'] == USER_ACTIVATION_NONE || !$config['email_enable'])
|
||||
if ($user_type == USER_NORMAL || !$config['email_enable'])
|
||||
{
|
||||
set_config('newest_user_id', $user_id);
|
||||
set_config('newest_username', $username);
|
||||
set_config('num_users', $config['num_users'] + 1, TRUE);
|
||||
set_config('num_users', $config['num_users'] + 1, true);
|
||||
}
|
||||
unset($data);
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ $lang += array(
|
|||
'EMAIL_INVALID_EMAIL' => 'The email address you entered is invalid.',
|
||||
'EMAIL_REMIND' => 'This must be the email address you supplied when registering.',
|
||||
'EMAIL_PM' => 'Email PM',
|
||||
'EMAIL_TAKEN_EMAIL' => 'The entered email address is already in use',
|
||||
'EMPTY_DRAFT' => 'You must enter a message to submit your changes',
|
||||
'EMPTY_DRAFT_TITLE' => 'You must enter a draft title',
|
||||
'EXPORT_AS_XML' => 'Export as XML',
|
||||
|
|
|
@ -648,7 +648,7 @@ switch ($mode)
|
|||
|
||||
// Additional sorting options for user search ... if search is enabled, if not
|
||||
// then only admins can make use of this (for ACP functionality)
|
||||
$sql_where = '';
|
||||
$sql_where = $form = $field = '';
|
||||
if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
|
||||
{
|
||||
$form = request_var('form', '');
|
||||
|
|
Loading…
Add table
Reference in a new issue