Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: borish - tammikuu 05, 2014, 12:11:09 IP

Otsikko: Need help modifying Register.php
Kirjoitti: borish - tammikuu 05, 2014, 12:11:09 IP
Hallo,

I installed Password Mod, which requires a registration password upon which applicants are assigned to a membergroup. However, it doesn't work the way I want. I want applicants to be rejected if they don't enter a correct registration password. This is what I want to do in function Register2($verifiedOpenID = false) in Register.php:

/** start Registration Password Mod **/
if(isset($modSettings['registration_password_use']))
{
if(isset($_POST['registration_password']))
{
$request = $smcFunc['db_query']('', "
SELECT `id_group`, `group_name`
FROM `{$db_prefix}membergroups`
WHERE `min_posts` = -1 AND `id_group` != '1' AND `id_group` != '2' AND `id_group` != '3'",
array(
)
);
while ($row = $smcFunc['db_fetch_assoc']($request)){
$registration_field_name = 'registration_password_'.$row['id_group'];
if($modSettings[$registration_field_name] == $_POST['registration_password'] && $modSettings[$registration_field_name] != '')
{
$registration['gid'] = $row['id_group'];
break;
}
}
$smcFunc['db_free_result']($request);
}
else /** show error message & reject **/
}
/** end Registration Password Mod **/

There may be several registration password / membergroup combinations, hence the loop. How do I reject the applicant?
Otsikko: Re: Need help modifying Register.php
Kirjoitti: Greg Zimmerman - tammikuu 05, 2014, 05:05:55 IP
Your members will be assigned to the membergroup registered for them, they will also need a password, passwords are required to install the some mods as you said. Other bars that come in and register do not enter a password for the new Administration, if the registration has been rejected, this will be your number of registrations decreased by 1.
Otsikko: Re: Need help modifying Register.php
Kirjoitti: borish - tammikuu 05, 2014, 05:36:45 IP
I've solved it: fatal_lang_error is what I need. http://support.simplemachines.org/function_db/index.php?action=view_function;id=45 (http://support.simplemachines.org/function_db/index.php?action=view_function;id=45)