Advertisement:

Author Topic: Making Gender and Birthday required for register  (Read 13929 times)

Offline Atoa

  • Semi-Newbie
  • *
  • Posts: 83
Making Gender and Birthday required for register
« on: December 04, 2009, 06:54:18 AM »
I want to make Gender and Birthday required for register.
I was able do add them to the register required fields by adding this code on the Register.template.php, bellow the allow email check box
Code: [Select]
<dt>
<strong>Sexo:</strong>
</dt>
<dd>
<select name="gender" id="gender" tabindex="8">
<option value="1" selected="selected">Masculino</option>
<option value="2" >Feminino</option>
</select>
</dd>

<dt>
<strong>Data de Nascimento:</strong><br />
<span class="smalltext">Ano (AAAA) - M&ecirc;s (MM) - Dia (DD)</span>
</dt>

<dd>
<input type="text" name="bday3" size="4" maxlength="4" value="1990" class="input_text" /> -
<input type="text" name="bday1" size="2" maxlength="2" value="00" class="input_text" /> -
<input type="text" name="bday2" size="2" maxlength="2" value="00" class="input_text" />
</dd>

Thanks in advance for any help

Offline ѕησω

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,432
  • Gender: Male
  • Nisi credideritis, non intelligetis.
    • wade.poulsen93 on Facebook
    • acans on GitHub
    • https://www.linkedin.com/profile/view?id=145186638 on LinkedIn
    • @imacans on Twitter
    • Acans
Re: Making Gender and Birthday required for register
« Reply #1 on: December 04, 2009, 08:22:42 AM »
Code: [Select]
//GENDER
echo '
<tr>
<td width="40%">
<b>Gender:</b>
</td>
<td>
<input type="radio" name="gender" value="1" checked="checked" tabindex="', $context['tabindex']++, '" />Male<br />
<input type="radio" name="gender" value="2" tabindex="', $context['tabindex']++, '" />Female<br />
</td>
</tr>';


//AGE
echo '
<tr>
<td width="40%">
<b>Birthday</b> <br/>
<div class="smalltext">day - month - year</div>
</td>
<td>
<input type="text" name="bday2" size="2" maxlength="2" tabindex="', $context['tabindex']++, '" value="" /> -
<input type="text" name="bday1" size="2" maxlength="2" tabindex="', @$context['tabindex']++, '"value="" /> -
<input type="text" name="bday3" size="4" maxlength="4" tabindex="', @$context['tabindex']++, '" value="" />
</td>
</tr>';

Use at your own risk, you didn't state what SMF version your using. So I would make a backup of register.template.php before doing this.
"The Book of Arantor, 17:3-5
  And I said unto him, thy database query shalt always be sent by the messenger of $smcFunc
  And $smcFunc shall protect you against injections and evil
  And so it came to pass that mysql_query was declared deprecated and even though he says he is not dead yet, the time was soon to come to pass when mysql_query shall be gone and no more."

Offline JBlaze

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,160
  • Gender: Male
    • @fragicide on Twitter
Re: Making Gender and Birthday required for register
« Reply #2 on: December 04, 2009, 10:31:40 AM »
If you are using SMF 2.0, you can use it's built-in custom profile fields to add these two fields to registration as well as make them mandatory. No need for template/source edits.

Admin -> Core Features -> Custom Profile Fields (enable)

Then go to Admin -> Features and Options -> Custom Profile Fields and set them up.
Jason Clemons
Former Lead Customizer/Support Specialist
Twitter | Facebook | Instagram

Offline KensonPlays

  • SMF Hero
  • ******
  • Posts: 4,306
    • @Kenson_Plays on Twitter
Re: Making Gender and Birthday required for register
« Reply #3 on: December 04, 2009, 10:40:46 AM »
yes, if possible, use SMF 2.0RC2, unless on a production site, as they say...

Offline Atoa

  • Semi-Newbie
  • *
  • Posts: 83
Re: Making Gender and Birthday required for register
« Reply #4 on: December 04, 2009, 03:46:23 PM »
Sorry for not stating which version i'm using. It's RC2

@JBlaze
I can't make this.
For gender there's no "required" field, only the option to show on registration, but it can be left blank.
And birthday isn't even showed on the Custom Profile Fields options.

@α¢αηѕ
I will give a try. I will edit the post if it's work

Edit:
The gender box worked fine, the way you did it's look far better, thanks
But the Birthday still can be left blank.
I want it to return a error if it's not filled and refuses the registration.

Edit 2:
I solved it. Instead of an type box, i will use an select box, so even if people ignore them, an bithday value will be added.
« Last Edit: December 04, 2009, 05:53:48 PM by Atoa »

Offline Afro

  • SMF Hero
  • ******
  • Posts: 1,855
  • Gender: Male
  • http://twitter.com/afrowall
    • Global Runs
Re: Making Gender and Birthday required for register
« Reply #5 on: February 02, 2010, 08:53:19 AM »
is there a way to link the newly created birthdates on the custom profile fields to the calendar ?

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Making Gender and Birthday required for register
« Reply #6 on: February 02, 2010, 10:13:57 AM »
i tried alot but cant get what i want from the option describe above...

plz see the pic attached ... i want it to display something like that..

can someone tell how to make it look like that
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline Afro

  • SMF Hero
  • ******
  • Posts: 1,855
  • Gender: Male
  • http://twitter.com/afrowall
    • Global Runs
Re: Making Gender and Birthday required for register
« Reply #7 on: February 02, 2010, 10:33:22 AM »
thats a vbulletin feature. i m not sure its here for now.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Making Gender and Birthday required for register
« Reply #8 on: February 02, 2010, 10:37:44 AM »
so can u tell how to make B'day boxes for users to input their B'days in it at time of registration..

Also If users skips it registration will not proceed
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline Afro

  • SMF Hero
  • ******
  • Posts: 1,855
  • Gender: Male
  • http://twitter.com/afrowall
    • Global Runs
Re: Making Gender and Birthday required for register
« Reply #9 on: February 02, 2010, 10:59:02 AM »
what version of smf are you using ? because i just did it on my forum.

www.afrowall.com. Check the registration and see if thats what you want.
But i opted for just month and day . January 10. i believe people dont usual;y like to share their real year of birth {especially ladies.}

Offline auto:blank

  • Semi-Newbie
  • *
  • Posts: 64
  • Gender: Male
    • Nepallica
Re: Making Gender and Birthday required for register
« Reply #10 on: February 02, 2010, 11:43:42 AM »
activating "Advanced Profile Fields" from core feature will make this possible.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Making Gender and Birthday required for register
« Reply #11 on: February 02, 2010, 12:26:16 PM »
im using RC2 ... like on ur forum www.afrowall.com

we have only one box for it .... can't we have 3 such drop down boxes ??

one containing months,other one days and last one year ...
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline Afro

  • SMF Hero
  • ******
  • Posts: 1,855
  • Gender: Male
  • http://twitter.com/afrowall
    • Global Runs
Re: Making Gender and Birthday required for register
« Reply #12 on: February 02, 2010, 04:47:08 PM »
You can create them on your own. on the custom profile, create a drop down for year. give it a name like Birth Year. and create drop down for it.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Making Gender and Birthday required for register
« Reply #13 on: February 03, 2010, 12:16:27 AM »
i've tried that already .... but try to think .... like i make a box for months containing all months .... then next box of year...

but problem comes at date ..i place count from 1 to 31...but

like January has 31 days ....

if someone chooses February then also he'll see 31 days (that will look absurd)

so thats the main problem
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline Afro

  • SMF Hero
  • ******
  • Posts: 1,855
  • Gender: Male
  • http://twitter.com/afrowall
    • Global Runs
Re: Making Gender and Birthday required for register
« Reply #14 on: February 03, 2010, 03:38:34 AM »
i've tried that already .... but try to think .... like i make a box for months containing all months .... then next box of year...

but problem comes at date ..i place count from 1 to 31...but

like January has 31 days ....

if someone chooses February then also he'll see 31 days (that will look absurd)

so thats the main problem

HMM. TRUE. but i wouldnt mind if i were you.

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Making Gender and Birthday required for register
« Reply #15 on: February 03, 2010, 04:51:39 AM »
so for now on im dropping this idea ..... if i get something i'll post it here for sure
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline Joker™

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,914
  • Gender: Male
    • siddhartha-gupta on GitHub
Re: Making Gender and Birthday required for register
« Reply #16 on: February 04, 2010, 07:13:04 AM »
i made it like this ... n values from here directly go into default B'day column in your profile ... :D
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Offline Afro

  • SMF Hero
  • ******
  • Posts: 1,855
  • Gender: Male
  • http://twitter.com/afrowall
    • Global Runs
Re: Making Gender and Birthday required for register
« Reply #17 on: February 06, 2010, 06:39:17 AM »
i made it like this ... n values from here directly go into default B'day column in your profile ... :D

how did you do that man ?

Offline InfoStrides

  • Full Member
  • ***
  • Posts: 497
  • www.TheInfoStrides.com
    • InfoStrides on Facebook
    • @TheInfoStrides on Twitter
    • TheInfoStrides.com
Re: Making Gender and Birthday required for register
« Reply #18 on: February 06, 2010, 11:38:17 AM »
i made it like this ... n values from here directly go into default B'day column in your profile ... :D

How did you do this? I am also interested.


Offline Afro

  • SMF Hero
  • ******
  • Posts: 1,855
  • Gender: Male
  • http://twitter.com/afrowall
    • Global Runs
Re: Making Gender and Birthday required for register
« Reply #19 on: February 06, 2010, 12:17:04 PM »
though i like the way i did mine.  i believe people dont really like to add the year of their birth on forums.