Hello,
Recently when I was making a plugin that added some special features to registration Pages, but I found there is no Hook as soon as input = "Register"
Well there should be a hook, say I want to display something BEFORE the Registration agreement or Remove the agreement, etc.
I had to add a a hook myself there.... but that ain't a good method.
INfo: Yeah i know you dont know me as a plugin maker, I make plugins for either my forums (which usually i quit after 4-5 months
) or friends.
There is no register.php, but I'll assume you meant member.php.
There are several hooks that might be of use to you:
You can also find the following hooks useful if you want to use data sent for the registration:
Some further knowledge:
The first set of hooks are run when the action GET parameter is set to register. The _start and _end hooks are run once the user accepts the registration agreement (after the POST request).
While the second set are ran when the user submits a successful registration.
Well, I think you didn't read my post.
Here is the code upto where the first Register_start hook is present
// Custom Hook
$plugins->run_hooks("member_register_start_x");
$bdaysel = '';
if($mybb->settings['coppa'] == "disabled")
{
$bdaysel = $bday2blank = "<option value=\"\"> </option>";
}
for($i = 1; $i <= 31; ++$i)
{
if($mybb->input['bday1'] == $i)
{
$bdaysel .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
}
else
{
$bdaysel .= "<option value=\"$i\">$i</option>\n";
}
}
$bdaymonthsel[$mybb->input['bday2']] = "selected=\"selected\"";
$mybb->input['bday3'] = intval($mybb->input['bday3']);
if($mybb->input['bday3'] == 0) $mybb->input['bday3'] = "";
// Is COPPA checking enabled?
if($mybb->settings['coppa'] != "disabled" && !$mybb->input['step'])
{
// Just selected DOB, we check
if($mybb->input['bday1'] && $mybb->input['bday2'] && $mybb->input['bday3'])
{
my_unsetcookie("coppauser");
$mybb->input['bday1'] = intval($mybb->input['bday1']);
$mybb->input['bday2'] = intval($mybb->input['bday2']);
$mybb->input['bday3'] = intval($mybb->input['bday3']);
$months = get_bdays($mybb->input['bday3']);
if($mybb->input['bday2'] < 1 || $mybb->input['bday2'] > 12 || $mybb->input['bday3'] < (date("Y")-100) || $mybb->input['bday3'] > date("Y") || $mybb->input['bday1'] > $months[$mybb->input['bday2']-1])
{
error($lang->error_invalid_birthday);
}
$bdaytime = @mktime(0, 0, 0, $mybb->input['bday2'], $mybb->input['bday1'], $mybb->input['bday3']);
// Store DOB in cookie so we can save it with the registration
my_setcookie("coppadob", "{$mybb->input['bday1']}-{$mybb->input['bday2']}-{$mybb->input['bday3']}", -1);
// User is <= 13, we mark as a coppa user
if($bdaytime >= mktime(0, 0, 0, my_date('n'), my_date('d'), my_date('Y')-13))
{
my_setcookie("coppauser", 1, -0);
$under_thirteen = true;
}
$mybb->request_method = "";
}
// Show DOB select form
else
{
$plugins->run_hooks("member_register_coppa");
my_unsetcookie("coppauser");
eval("\$coppa = \"".$templates->get("member_register_coppa")."\";");
output_page($coppa);
exit;
}
}
if((!isset($mybb->input['agree']) && !isset($mybb->input['regsubmit'])) || $mybb->request_method != "post")
{
// Is this user a COPPA user? We need to show the COPPA agreement too
if($mybb->settings['coppa'] != "disabled" && ($mybb->cookies['coppauser'] == 1 || $under_thirteen))
{
if($mybb->settings['coppa'] == "deny")
{
error($lang->error_need_to_be_thirteen);
}
$lang->coppa_agreement_1 = $lang->sprintf($lang->coppa_agreement_1, $mybb->settings['bbname']);
eval("\$coppa_agreement = \"".$templates->get("member_register_agreement_coppa")."\";");
}
$plugins->run_hooks("member_register_agreement");
eval("\$agreement = \"".$templates->get("member_register_agreement")."\";");
output_page($agreement);
}
else
{
$plugins->run_hooks("member_register_start");
what if i want a new condition before this one:
if((!isset($mybb->input['agree']) && !isset($mybb->input['regsubmit'])) || $mybb->request_method != "post")
I cant do it, since no hook is present before it.
I did read your post and I didn't fully understand where you wished to hook. If you are looking for a way to disable the registration agreement see
this post
Well, Its better that you read.