Code: Select all
*/
Code: Select all
//mod: Require Birth Date on Registration -----------------------------------//
/**
* This contains functions for verifying and displaying the birth date.
*/
include($phpbb_root_path . 'includes/functions_birthdate.' . $phpEx);
//end: Require Birth Date on Registration -----------------------------------//
Code: Select all
// validate custom profile fields
Code: Select all
//mod: Require Birth Date on Registration -----------------------------------//
if (($result = validate_birth_date($data['bday_day'] . '-' . $data['bday_month'] . '-' . $data['bday_year'])) !== false)
{
$user->add_lang('mods/require_birth_date');
if ($result == 'NO_BIRTH_DATE')
{
$result = 'INVALID_BIRTH_DATE';
}
$error[] = $result;
}
//end: Require Birth Date on Registration -----------------------------------//
Code: Select all
//mod: Require Birth Date on Registration -----------------------------------//
//- - - - - - - - - - - - - - - - - - - - - - - - - //
//This function will return a person's current age. It accepts the date in //
//the form of a string, in the format "day-month-year". //
//- - - - - - - - - - - - - - - - - - - - - - - - - //
function get_age($date_of_birth) //day-month-year
{
$birth = explode("-", $date_of_birth);
$age = date("Y") - $birth[2];
if (($birth[1] > date("m")) || ($birth[1] == date("m") && date("d") < $birth[0]))
{
$age -= 1;
}
return $age;
}
//- - - - - - - - - - - - - - - - - - - - - - - - - //
//This function will validate a birth date. It accepts the date in the form //
//of a string, in the format "day-month-year". //
//- - - - - - - - - - - - - - - - - - - - - - - - - //
function validate_birth_date($date_of_birth) //day-month-year
{
$minimum_age = 4;
$birth = explode("-", $date_of_birth);
if ((!$birth[0] || !$birth[1] || !$birth[2]))
{
return 'NO_BIRTH_DATE';
}
if ($birth[0] < 0 || $birth[0] > 31 || $birth[1] < 0 || $birth[1] > 12 || ($birth[2] < 1901 && $birth[2] > 0) || $birth[2] > gmdate('Y', time()))
{
return 'INVALID_BIRTH_DATE';
}
if (checkdate($birth[1], $birth[0], $birth[2]) === false)
{
return 'INVALID_BIRTH_DATE';
}
if (get_age($date_of_birth) < $minimum_age)
{
return 'TOO_YOUNG';
}
return(false);
}
//end: Require Birth Date on Registration -----------------------------------//
Code: Select all
//mod: Require Birth Date on Registration -----------------------------------//
/**
* This contains functions for verifying and displaying the birth date.
*/
include($phpbb_root_path . 'includes/functions_birthdate.' . $phpEx);
//end: Require Birth Date on Registration -----------------------------------//
Code: Select all
//mod: Require Birth Date on Registration -----------------------------------//
//- - - - - - - - - - - - - - - - - - - - - - - - - //
//Here we grab submitted birth date information, or initialize it if none //
//exists. Then we create the birth date form fields for display in the //
//templates (much of that code is copied from ucp_profile.php). //
//- - - - - - - - - - - - - - - - - - - - - - - - - //
$bday['month'] = request_var('bday_month', 0);
$bday['day'] = request_var('bday_day', 0);
$bday['year'] = request_var('bday_year', 0);
$bday['date'] = sprintf('%2d-%2d-%4d', $bday['day'], $bday['month'], $bday['year']);
$s_birthday_day_options = '<option value="0"' . ((!$bday['day']) ? ' selected="selected"' : '') . '>' . $user->lang['DAY'] . '</option>';
for ($i = 1; $i < 32; $i++)
{
$selected = ($i == $bday['day']) ? ' selected="selected"' : '';
$s_birthday_day_options .= "<option value=\"$i\"$selected>$i</option>";
}
$s_birthday_month_options = '<option value="0"' . ((!$bday['month']) ? ' selected="selected"' : '') . '>' . $user->lang['MONTH'] . '</option>';
for ($i = 1, $lang_dates = $user->lang['datetime']; $i < 13; $i++)
{
$display_month = strtr(@gmdate('M', strtotime("2000-{$i}-01")), $lang_dates);
$selected = ($i == $bday['month']) ? ' selected="selected"' : '';
$s_birthday_month_options .= "<option value=\"$i\"$selected>{$display_month}</option>";
}
$s_birthday_year_options = '';
$now = getdate();
$s_birthday_year_options = '<option value="0"' . ((!$bday['year']) ? ' selected="selected"' : '') . '>' . $user->lang['YEAR'] . '</option>';
for ($i = $now['year'] - 100; $i < $now['year']; $i++)
{
$selected = ($i == $bday['year']) ? ' selected="selected"' : '';
$s_birthday_year_options .= "<option value=\"$i\"$selected>$i</option>";
}
unset($now);
$template->assign_vars(array(
'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options,
'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options,
'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options,)
);
//end: Require Birth Date on Registration -----------------------------------//
Code: Select all
//mod: Require Birth Date on Registration -----------------------------------//
//- - - - - - - - - - - - - - - - - - - - - - - - - //
//We grab submitted birth date information, or initialize it if none exists. //
//Then we create the birth date form fields for display in the templates. //
//- - - - - - - - - - - - - - - - - - - - - - - - - //
$bday['month'] = request_var('bday_month', 0);
$bday['day'] = request_var('bday_day', 0);
$bday['year'] = request_var('bday_year', 0);
$bday['date'] = sprintf('%2d-%2d-%4d', $bday['day'], $bday['month'], $bday['year']);
$bday_options = get_birth_date_options($bday['date']);
$template->assign_vars(array(
'S_BIRTHDAY_DAY_OPTIONS' => $bday_options[0],
'S_BIRTHDAY_MONTH_OPTIONS' => $bday_options[1],
'S_BIRTHDAY_YEAR_OPTIONS' => $bday_options[2],
));
//end: Require Birth Date on Registration -----------------------------------//
Hard to tell without any error messages. Can you send me the files that you modified so I can take a look? Do you have access to your server's error logs?Sylwia wrote:Hi, I installed this mod, but the registration page is blank now, I also can't logout when I'm logged in. Any idea what might have gone wrong?
I checked and rechecked everything, and am not sure what else I might do. Any help will be appreciated.
http://scotch-and-sirens.waw.pl/phpBB3/index.php
Sylwia
I looked over the files you sent and didn't see anything wrong. If you removed all of the changes and it still doesn't work, then maybe you accidentally added in a typo somewhere when originally installing it. I know I've done that a few times, accidentally deleting a semicolon or an ending brace. Getting ahold of those error logs would really help. And if you haven't installed many MODs, perhaps you could copy over a fresh version of the phpbb3 files (minus the config.php of course).Sylwia wrote:Sure, just tell me how to send them or email me.
I don't have access to my server's error logs, but I wrote to my provider, so hopefully they'll answer back.
Also, I returned to my previous settings and it's still not working.
Sylwia