Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3680)
Birthdate On Registration v1.0Add Birthday date field on registration page!
CompatibilitySMF 2.0
Mod by: Mr. Pedram (http://www.simplemachines.org/community/index.php?action=profile;u=323252)
This mod is licensed under a CC BY-NC-ND 3.0 (http://creativecommons.org/licenses/by-nc-nd/3.0/)
FYI, it's spelt "Registration" ;)
Quote from: Shambles on March 31, 2013, 02:08:26 PM
FYI, it's spelt "Registration" ;)
Thanks for that, it was damn misspelling.
Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
Quote from: FireDitto on March 31, 2013, 10:21:22 PM
Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
If you are on 2.04 then you can do that without the mod.
Quote from: Old Fossil on March 31, 2013, 10:34:15 PM
Quote from: FireDitto on March 31, 2013, 10:21:22 PM
Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
If you are on 2.04 then you can do that without the mod.
I am. And you can? I don't see anything for it in the admin areas.
/me would like to know what Fossil is referring to as well.
If I am correct (hopefully) then look at Core Feature >> Advanced Profile Features.
It's not an option in there. Nor is it an option in the calendar, nor in registration settings (even if you put a minimum age in)
Rightio my apologies FireDitto.
/me should really get reaquainted with 2.0.4
Hehe, it's okay :)
Quote from: FireDitto on March 31, 2013, 10:21:22 PM
Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
It's possible, with a little programming. I'll try, maybe on the first update.
Quote from: Mr. Pedram on April 01, 2013, 05:22:09 PM
Quote from: FireDitto on March 31, 2013, 10:21:22 PM
Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
It's possible, with a little programming. I'll try, maybe on the first update.
That would be brilliant :D
Quote from: FireDitto on April 02, 2013, 01:43:05 AM
Quote from: Mr. Pedram on April 01, 2013, 05:22:09 PM
Quote from: FireDitto on March 31, 2013, 10:21:22 PM
Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
It's possible, with a little programming. I'll try, maybe on the first update.
That would be brilliant :D
Well, here you go :)
Register.php// Handle a string as a birthdate...
if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
// Or birthdate parts...
elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']))
$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
// Handle a string as a birthdate...
if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
// Or birthdate parts...
elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']) && !empty($_POST['bday3']))
$_POST['birthdate'] = sprintf('%04d-%02d-%02d', (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
'theme_vars' => array(),
'birthdate' => $_POST['birthdate'],
Subs-Members.phpif (!empty($regOptions['check_reserved_name']) && isReservedName($regOptions['username'], 0, false))
// Birthdate Checking!
if (empty($regOptions['birthdate']) || $regOptions['birthdate'] == '0000-00-00')
{
fatal_error('Birthday is a required field!',false);
}else{
$arr=split("-",$regOptions['birthdate']); // splitting the array
$mm=$arr[1]; // first element of the array is month
$dd=$arr[2]; // second element is date
$yy=$arr[0]; // third element is year
If(!checkdate($mm,$dd,$yy)){
fatal_error('The Birthday you entered appears to be invalid!',false);
}
}
list($Y,$m,$d) = explode("-",$regOptions['birthdate']);
If ((date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y) < $modSettings['coppaAge'])
fatal_error('Sorry! You are too young.',false);
'REALNAME' => $regOptions['register_vars']['real_name'],
'birthdate' => $regOptions['birthdate'],
Be sure you installed the MOD first.
Thank you!
Tested and works wonderfully.
Which file would I need to look in to find where it says Birthday so I could put (required) after it in brackets so people know? I attempted to edit the ./Themes/default/languages/Login.english.php , but it doesn't appear to be working :/
Quote from: FireDitto on April 12, 2013, 06:22:03 AM
Thank you!
Tested and works wonderfully.
Which file would I need to look in to find where it says Birthday so I could put (required) after it in brackets so people know? I attempted to edit the ./Themes/default/languages/Login.english.php , but it doesn't appear to be working :/
You'r welcome.
Hmmm... weird!
Because you need edit Login.english.php exactly.
Like this:$txt['dob'] = 'Birthdate:';
$txt['dob_month'] = 'Month (MM)';
$txt['dob_day'] = 'Day (DD)';
$txt['dob_year'] = 'Year (YYYY)';
$txt['dob'] = 'Birthdate (required):';
$txt['dob_month'] = 'Month (MM)';
$txt['dob_day'] = 'Day (DD)';
$txt['dob_year'] = 'Year (YYYY)';
if doesn't work, try this:./Register.template.php<strong>', $txt['dob'], '</strong><br />
<strong>', $txt['dob'], ' ', $txt['dob_req'], '</strong><br />
./Login.english.php$txt['dob'] = 'Birthdate:';
$txt['dob_req'] = '(required)';
:/ I had to remove the requirement edits you made, because it won't let us create Sub Accounts as a result since Sub Accounts don't offer a birthdate option upon setting them up.
Quote from: FireDitto on April 14, 2013, 10:25:35 PM
:/ I had to remove the requirement edits you made, because it won't let us create Sub Accounts as a result since Sub Accounts don't offer a birthdate option upon setting them up.
Sorry, but i don't understand what you mean about Sub Accounts
did you mean Sub-Account mod?
I do, yes, sorry :)
Quote from: FireDitto on April 15, 2013, 05:26:25 AM
I do, yes, sorry :)
Oh that, yes it doesn't support sub accounts.
Quote from: Mr. Pedram on April 06, 2013, 04:38:11 AM
Quote from: FireDitto on April 02, 2013, 01:43:05 AM
Quote from: Mr. Pedram on April 01, 2013, 05:22:09 PM
Quote from: FireDitto on March 31, 2013, 10:21:22 PM
Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
It's possible, with a little programming. I'll try, maybe on the first update.
That would be brilliant :D
Well, here you go :)
Register.php
// Handle a string as a birthdate...
if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
// Or birthdate parts...
elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']))
$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
// Handle a string as a birthdate...
if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
// Or birthdate parts...
elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']) && !empty($_POST['bday3']))
$_POST['birthdate'] = sprintf('%04d-%02d-%02d', (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
'theme_vars' => array(),
'birthdate' => $_POST['birthdate'],
Subs-Members.php
if (!empty($regOptions['check_reserved_name']) && isReservedName($regOptions['username'], 0, false))
// Birthdate Checking!
if (empty($regOptions['birthdate']) || $regOptions['birthdate'] == '0000-00-00')
{
fatal_error('Birthday is a required field!',false);
}else{
$arr=split("-",$regOptions['birthdate']); // splitting the array
$mm=$arr[1]; // first element of the array is month
$dd=$arr[2]; // second element is date
$yy=$arr[0]; // third element is year
If(!checkdate($mm,$dd,$yy)){
fatal_error('The Birthday you entered appears to be invalid!',false);
}
}
list($Y,$m,$d) = explode("-",$regOptions['birthdate']);
If ((date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y) < $modSettings['coppaAge'])
fatal_error('Sorry! You are too young.',false);
'REALNAME' => $regOptions['register_vars']['real_name'],
'birthdate' => $regOptions['birthdate'],
Be sure you installed the MOD first.
This isn't part of the mod right? Will you make the requirement part of it?
Hello!
Can it be done to force people to enter dob in the registration for 2.0.6?
Tested your mod and it works, and I even tried your solutions but no luck with that part :-\
It would be really nice of you if you can help me (and others) with this one. We are probably going
over to be an association and when thats done we gonna need dob, adresses, real names & phone-numbers
to be stored into the database to get allowance from Sverok (Swedish association). If you even can take this
to a higher level and fix all of this into one mod, many associations would be soooo thankful :laugh:
Many regards
Smirre
Since it is not required on registration, how would I go about making it show up under the "Additional Information" section instead of the "Required Information" section on the registration page?
Quote from: Westwegoman on April 17, 2014, 03:17:57 PM
Since it is not required on registration, how would I go about making it show up under the "Additional Information" section instead of the "Required Information" section on the registration page?
sounds good
Quote from: smirre on November 26, 2013, 11:45:35 AM
Hello!
Can it be done to force people to enter dob in the registration for 2.0.6?
Tested your mod and it works, and I even tried your solutions but no luck with that part :-\
It would be really nice of you if you can help me (and others) with this one. We are probably going
over to be an association and when thats done we gonna need dob, adresses, real names & phone-numbers
to be stored into the database to get allowance from Sverok (Swedish association). If you even can take this
to a higher level and fix all of this into one mod, many associations would be soooo thankful :laugh:
Many regards
Smirre
I'll update all my Mods soon, maybe on the next update i do this.
Thanks for this mod but instead of entering value can we have a dropdown like this mod http://custom.simplemachines.org/mods/index.php?mod=3118.
I tried using the code of drop down from http://custom.simplemachines.org/mods/index.php?mod=3118 but not succeeded.It looks like this
it is not in center.
Hope anyone will help.
Thanks
I've made the changes Mr. Pedram said for the birthday to be obligatory in the register (only don't edit the part of
'REALNAME' => $regOptions['register_vars']['real_name'],) and it works. ;)
Quote from: r4ll on July 04, 2014, 03:36:29 AM
Thanks for this mod but instead of entering value can we have a dropdown like this mod http://custom.simplemachines.org/mods/index.php?mod=3118.
I tried using the code of drop down from http://custom.simplemachines.org/mods/index.php?mod=3118 but not succeeded.It looks like this
it is not in center.
Hope anyone will help.
Thanks
//Show Birthday
global $txt;
echo '
<dl class="register_form">
<dt>
<strong>', $txt['dob'], '</strong><br />
<span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
</dt>
<dd>
<input type="text" name="bday3" size="4" maxlength="4" value="', (!empty($context['member']['birth_date']) ? $context['member']['birth_date']['year'] : ''), '" /> -
<input type="text" name="bday1" size="2" maxlength="2" value="', (!empty($context['member']['birth_date']) ? $context['member']['birth_date']['month'] : ''), '" /> -
<input type="text" name="bday2" size="2" maxlength="2" value="', (!empty($context['member']['birth_date']) ? $context['member']['birth_date']['day'] : ''), '" />
</dd>
</dl>';
if (cache_get_data('intuitive_age', 120) != null)
$years = cache_get_data('intuitive_age', 120);
else
{
$years = array();
$base_year = 1904;
$current_year = date('Y');
$count = $base_year;
$age = 0;
$ages = array();
while ($count < $current_year)
{
++$count;
$years[] = $count;
}
$years = array_reverse($years);
foreach ($years as $year)
{
$ages[$year] = ++$age;
$year = array();
$year[$age] = $year;
}
cache_put_data('intuitive_age', $years, 120);
}
$days = array(
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 31,
);
//Show Birthday
echo '
<dl class="register_form">
<dt>
<strong>', $txt['dob'], ':</strong><br />
<span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
</dt>
<dd>
<select name="bday1" id="bday1" style="padding: 4px;">
<option value="00" selected="selected">', $txt['calendar_month'], ' </option>';
foreach ($txt['months_short'] as $key => $month)
echo '<option value="', $key, '">', $month, '</option>';
echo '
</select>
<select name="bday2" id="bday2" style="padding: 4px;">
<option value="00" selected="selected">', $txt['calendar_day'], ' </option>';
foreach ($days as $day)
echo '
<option value="', $day, '">', $day, ' </option>';
echo '
</select>';
if (!empty($years))
{
echo '
<select name="bday3" id="bday3" style="padding: 4px;">
<option value="0000" selected="selected">', $txt['calendar_year'], ' </option>';
foreach ($years as $key => $year)
echo '<option value="', $year, '">', $year, ' </option>';
echo '</select>';
}
else
echo '<input type="text" name="bday3" size="4" maxlength="4" value"', $context['member']['birth_date']['year'], '" class="input_text" />';
echo '
</dd>
Obviously after you have installed the mod. ;)
Nice work.. Thanks :)
Please is there a way I could handle this problem.
This mod helps to make members registration page more organised.
I set a configuration on my forum tthat only 14years and above will register.
But this mod is being deceived as a member just registered with 0000year 00month 00day. And it accepted him.
Is there anything I will do?
i have these errors
Undefined index: coppaAge
/Sources/Subs-Members.php
Regel: 540
and
Function split() is deprecated
/Sources/Subs-Members.php
Regel: 531
Any one?
i have SMF 2.0.10
Is there any chance to use this mod on 2.1rc2 without emulating?
It doesn't show up on register page.
I think that's your answer; even with emulation it doesn't work because so much has changed in 2.1.
I like the changes of 2.1 but I miss all these mods. :-\
Quote from: pocttopus on June 02, 2020, 06:05:41 PM
I like the changes of 2.1 but I miss all these mods. :-\
Then wait for 2.1 to be finished, then authors will update mods.
Oh... I'll wait... I hope I'm not going to be too old for 2.1 stable version. ::)
Quote from: Mr. Pedram on April 06, 2013, 04:38:11 AMQuote from: FireDitto on April 02, 2013, 01:43:05 AMQuote from: Mr. Pedram on April 01, 2013, 05:22:09 PMQuote from: FireDitto on March 31, 2013, 10:21:22 PMOoh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
It's possible, with a little programming. I'll try, maybe on the first update.
That would be brilliant :D
Well, here you go :)
Register.php
// Handle a string as a birthdate...
if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
// Or birthdate parts...
elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']))
$_POST['birthdate'] = sprintf('%04d-%02d-%02d', empty($_POST['bday3']) ? 0 : (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
// Handle a string as a birthdate...
if (isset($_POST['birthdate']) && $_POST['birthdate'] != '')
$_POST['birthdate'] = strftime('%Y-%m-%d', strtotime($_POST['birthdate']));
// Or birthdate parts...
elseif (!empty($_POST['bday1']) && !empty($_POST['bday2']) && !empty($_POST['bday3']))
$_POST['birthdate'] = sprintf('%04d-%02d-%02d', (int) $_POST['bday3'], (int) $_POST['bday1'], (int) $_POST['bday2']);
'theme_vars' => array(),
'birthdate' => $_POST['birthdate'],
Subs-Members.php
if (!empty($regOptions['check_reserved_name']) && isReservedName($regOptions['username'], 0, false))
// Birthdate Checking!
if (empty($regOptions['birthdate']) || $regOptions['birthdate'] == '0000-00-00')
{
fatal_error('Birthday is a required field!',false);
}else{
$arr=split("-",$regOptions['birthdate']); // splitting the array
$mm=$arr[1]; // first element of the array is month
$dd=$arr[2]; // second element is date
$yy=$arr[0]; // third element is year
If(!checkdate($mm,$dd,$yy)){
fatal_error('The Birthday you entered appears to be invalid!',false);
}
}
list($Y,$m,$d) = explode("-",$regOptions['birthdate']);
If ((date("md") < $m.$d ? date("Y")-$Y-1 : date("Y")-$Y) < $modSettings['coppaAge'])
fatal_error('Sorry! You are too young.',false);
'REALNAME' => $regOptions['register_vars']['real_name'],
'birthdate' => $regOptions['birthdate'],
Be sure you installed the MOD first.
Hello everyone
Problem, installed this mod, everything works, but when I configure the mandatory input of the date of birth, it gives an error Cfll to undefined -> function split ()
I was able to get this mod to work on 2.1.1 clean install with no errors.
Instructions below. ;)
Backup your files and database first!!
Upload the mod and then you'll have to emulate it for 2.0.10.
Ignore the error and click on install.
Then open your Themes/default/Register.template.php...
Find:
<dl class="register_form" id="notify_announcements">
<dt>
<strong><label for="notify_announcements">', $txt['notify_announcements'], ':</label></strong>
</dt>
<dd>
<input type="checkbox" name="notify_announcements" id="notify_announcements" tabindex="', $context['tabindex']++, '"', $context['notify_announcements'] ? ' checked="checked"' : '', '>
</dd>
</dl>';
// If there is any field marked as required, show it here!
Add Before:
<dl class="register_form">
<dt>
<strong>', $txt['dob'], '</strong><br />
<span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
</dt>
<dd>
<input type="text" name="bday3" size="4" maxlength="4" value="', (!empty($context['member']['birth_date']) ? $context['member']['birth_date']['year'] : ''), '" /> -
<input type="text" name="bday1" size="2" maxlength="2" value="', (!empty($context['member']['birth_date']) ? $context['member']['birth_date']['month'] : ''), '" /> -
<input type="text" name="bday2" size="2" maxlength="2" value="', (!empty($context['member']['birth_date']) ? $context['member']['birth_date']['day'] : ''), '" />
</dd>
</dl>
That's it! 8)
You cannot view this attachment.
I don't know how to make the Birthdate Field "required" though! :(