News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Changing Group Upon Languge change.

Started by ncaridi, November 23, 2005, 11:17:39 AM

Previous topic - Next topic

ncaridi

Hello,
I edited my Register.php + template so when a user registers hes choosing preffered language and then when he does hes auto. gets into a group of his language.
I want to thave the same functionalty in the profile.php
so if the user decides to change the language again . hes going into the other groups.
of course this funcion will not work for the administrator...
heres what i've done in register.php and sub-members.php if you have anyfeedback.
in register.php
// Set the options needed for registration.
$regOptions = array(
'interface' => 'guest',
'username' => $_POST['user'],
'email' => $_POST['email'],
'password' => $_POST['passwrd1'],
'password_check' => $_POST['passwrd2'],
'check_reserved_name' => true,
'check_password_strength' => true,
'check_email_ban' => true,
'send_welcome_email' => !empty($modSettings['send_welcomeEmail']),
'require' => !empty($modSettings['coppaAge']) && !isset($_POST['skip_coppa']) ? 'coppa' : (empty($modSettings['registration_method']) ? 'nothing' : ($modSettings['registration_method'] == 1 ? 'activation' : 'approval')),
'extra_register_vars' => array(),
'theme_vars' => array(),
'group' => 0
);

if ($selected_language=='english')
$regOptions["group"] =10;
elseif ($selected_language=='hebrew')
$regOptions["group"] =9;


in sub-members.php
// Some of these might be overwritten. (the lower ones that are in the arrays below.)
$regOptions['register_vars'] = array(
'memberName' => "'$regOptions[username]'",
'emailAddress' => "'$regOptions[email]'",
'passwd' => '\'' . sha1(strtolower($regOptions['username']) . $regOptions['password']) . '\'',
'passwordSalt' => '\'' . substr(md5(rand()), 0, 4) . '\'',
'posts' => 0,
'dateRegistered' => time(),
'memberIP' => "'$user_info[ip]'",
'validation_code' => "'$validation_code'",
'realName' => "'$regOptions[username]'",
'personalText' => '\'' . addslashes($modSettings['default_personalText']) . '\'',
'pm_email_notify' => 1,
'ID_THEME' => 0,
'ID_POST_GROUP' => 4,
'ID_GROUP' =>$regOptions[group]
);

thats working great .. ;D
should i make this a function in a differrent file ?
any ideas ?

Thanks Nadi.

Advertisement: