News:

SMF 2.1.3 has been released! Take it for a spin! Read more.

Main Menu

Birthdate On Registration

Started by Mr. Pedram, March 31, 2013, 01:51:41 PM

Previous topic - Next topic

Mr. Pedram

Link to Mod

Birthdate On Registration v1.0
Add Birthday date field on registration page!

Compatibility
SMF 2.0

Mod by: Mr. Pedram


This mod is licensed under a CC BY-NC-ND 3.0
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

Shambles


Mr. Pedram

Quote from: Shambles on March 31, 2013, 02:08:26 PM
FYI, it's spelt "Registration" ;)

Thanks for that, it was damn misspelling.
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

FireDitto

Ooh, lovely! I do have a question, though! Would it be possible to make the birthday input required for registration?
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

TheListener

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.

FireDitto

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.
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

Arantor

* Rainbow Dash would like to know what Fossil is referring to as well.

TheListener

If I am correct (hopefully) then look at Core Feature >> Advanced Profile Features.


Arantor

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)

TheListener

Rightio my apologies FireDitto.

* Old Fossil should really get reaquainted with 2.0.4

FireDitto

Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

Mr. Pedram

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.
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

FireDitto

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
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

Mr. Pedram

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

Code (Find) Select
// 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']);


Code (Replace With) Select
// 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']);


Code (Find) Select
'theme_vars' => array(),

Code (Add After) Select
'birthdate' => $_POST['birthdate'],




Subs-Members.php

Code (Find) Select
if (!empty($regOptions['check_reserved_name']) && isReservedName($regOptions['username'], 0, false))

Code (Add Before) Select
// 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);


Code (Find) Select
'REALNAME' => $regOptions['register_vars']['real_name'],

Code (Add After) Select
'birthdate' => $regOptions['birthdate'],

Be sure you installed the MOD first.
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

FireDitto

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 :/
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

Mr. Pedram

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:

Code (Find) Select
$txt['dob'] = 'Birthdate:';
$txt['dob_month'] = 'Month (MM)';
$txt['dob_day'] = 'Day (DD)';
$txt['dob_year'] = 'Year (YYYY)';


Code (Replace) Select
$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

Code (Find) Select
<strong>', $txt['dob'], '</strong><br />

Code (Replace) Select
<strong>', $txt['dob'], ' ', $txt['dob_req'], '</strong><br />

./Login.english.php

Code (Find) Select
$txt['dob'] = 'Birthdate:';

Code (Add After) Select
$txt['dob_req'] = '(required)';
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

FireDitto

:/ 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.
Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

Mr. Pedram

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?
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

FireDitto

Second Pass Weyr<br />An AU Pernse RPG<br /><br />SMF 2.0.6 with SP 2.3.5

Mr. Pedram

My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

Advertisement: