News:

Wondering if this will always be free?  See why free is better.

Main Menu

Making Gender and Birthday required for register

Started by Atoa, December 04, 2009, 06:54:18 AM

Previous topic - Next topic

Atoa

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
<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

Acans


//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

JBlaze

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 Team Member 2009 - 2012

KensonPlays

yes, if possible, use SMF 2.0RC2, unless on a production site, as they say...

Atoa

#4
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.

Afro

is there a way to link the newly created birthdates on the custom profile fields to the calendar ?

Joker™

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

Afro

thats a vbulletin feature. i m not sure its here for now.

Joker™

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

Afro

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.}

auto:blank

activating "Advanced Profile Fields" from core feature will make this possible.

Joker™

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

Afro

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.

Joker™

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

Afro

Quote from: sid2varun 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

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

Joker™

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

Joker™

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

Afro

Quote from: sid2varun 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

how did you do that man ?

InfoStrides

Quote from: sid2varun 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

How did you do this? I am also interested.


Afro

though i like the way i did mine.  i believe people dont really like to add the year of their birth on forums.

Advertisement: