Add Genders option on register phpBB3

Tips & Tricks to use on your phpBB3 Forum.
Post Reply
User avatar
LDM
Site Admin
Site Admin
Posts: 1794
Joined: Thu May 29, 2008 6:51 pm

Add Genders option on register phpBB3

Post by LDM » Fri Oct 24, 2008 2:13 pm

If you are running Genders mod on your forum, you can make it default on register that a new member select the Gender.

Here's how:

Open includes/ucp/ucp_register.php

Find:

Code: Select all

'tz'            => request_var('tz', (float) $config['board_timezone']),


Add below:

Code: Select all

//-- mod : Genders ------------------------------------------------------------
//-- add
                    'gender'      => request_var('gender', $user->data['user_gender']),
//-- fin mod : Genders --------------------------------------------------------


Find:

Code: Select all

'tz'            => request_var('tz', (float) $timezone),


Add below:

Code: Select all

//-- mod : Genders ------------------------------------------------------------
//-- add
            'gender'      => request_var('gender', $user->data['user_gender']),
//-- fin mod : Genders --------------------------------------------------------


Find:

Code: Select all

'lang'            => array('match', false, '#^[a-z_\-]{2,}$#i'),


Add Below:

Code: Select all

//-- mod : Genders ------------------------------------------------------------
//-- add
                'gender'      => array('num', true, 0, 2),
//-- fin mod : Genders --------------------------------------------------------


Find:

Code: Select all

'user_inactive_time'   => $user_inactive_time,


Add Below:

Code: Select all

//-- mod : Genders ------------------------------------------------------------
//-- add
                    'user_gender'   => $data['gender'],
//-- fin mod : Genders --------------------------------------------------------


Find:

Code: Select all

'S_TZ_OPTIONS'      => tz_select($data['tz']),


Add Below:

Code: Select all

//-- mod : Genders ------------------------------------------------------------
//-- add
            'GENDER_X'      => GENDER_X,
            'GENDER_M'      => GENDER_M,
            'GENDER_F'      => GENDER_F,

            'S_GENDER_X'   => ($data['gender'] == GENDER_X) ? true : false,
            'S_GENDER_M'   => ($data['gender'] == GENDER_M) ? true : false,
            'S_GENDER_F'   => ($data['gender'] == GENDER_F) ? true : false,
//-- fin mod : Genders --------------------------------------------------------


Now open: styles/subsilver2/template/ucp_register.html (or subsilver based style)

Find:

Code: Select all

<tr>
   <td class="row1"><b class="genmed">{L_TIMEZONE}: </b></td>
   <td class="row2"><select name="tz">{S_TZ_OPTIONS}</select></td>
</tr>


Add below:

Code: Select all

<tr>
   <td class="row1" width="35%"><b class="genmed"><label for="gender_x">{L_GENDER}:</label> </b><br /><span class="gensmall">{L_GENDER_EXPLAIN}</span></td>
   <td class="row2">
      <label for="gender_m"><input type="radio" name="gender" id="gender_m" value="{GENDER_M}"<!-- IF S_GENDER_M --> checked="checked"<!-- ENDIF --> /> {L_GENDER_M}</label>
      <label for="gender_f"><input type="radio" name="gender" id="gender_f" value="{GENDER_F}"<!-- IF S_GENDER_F --> checked="checked"<!-- ENDIF --> /> {L_GENDER_F}</label>
      <label for="gender_x"><input type="radio" name="gender" id="gender_x" value="{GENDER_X}"<!-- IF S_GENDER_X --> checked="checked"<!-- ENDIF --> /> {L_GENDER_X}</label>
   </td>
</tr>


Now open: styles/prosilver/template/ucp_register.html (or prosilver based style)


Find:

Code: Select all

<dl>
      <dt><label for="tz">{L_TIMEZONE}:</label></dt>
      <dd><select name="tz" id="tz" class="autowidth">{S_TZ_OPTIONS}</select></dd>
   </dl>


Add below:

Code: Select all

<dl>
      <dt><label for="gender_x">{L_GENDER}:</label><br /><span>{L_GENDER_EXPLAIN}</span></dt>
      <dd>
         <label for="gender_m"><input type="radio" name="gender" id="gender_m" value="{GENDER_M}"<!-- IF S_GENDER_M --> checked="checked"<!-- ENDIF --> /> {L_GENDER_M}</label>
         <label for="gender_f"><input type="radio" name="gender" id="gender_f" value="{GENDER_F}"<!-- IF S_GENDER_F --> checked="checked"<!-- ENDIF --> /> {L_GENDER_F}</label>
         <label for="gender_x"><input type="radio" name="gender" id="gender_x" value="{GENDER_X}"<!-- IF S_GENDER_X --> checked="checked"<!-- ENDIF --> /> {L_GENDER_X}</label>
      </dd>
   </dl>


Upload files, purge cache and refresh template used.

User avatar
MadFly
Forum Member
Forum Member
Posts: 24
Joined: Wed Apr 08, 2009 10:46 pm

Re: Add Genders option on register phpBB3

Post by MadFly » Wed Apr 08, 2009 11:33 pm

Can you not do this with Custom Profile Fields? Would it not have the same effect?

User avatar
LDM
Site Admin
Site Admin
Posts: 1794
Joined: Thu May 29, 2008 6:51 pm

Re: Add Genders option on register phpBB3

Post by LDM » Thu Apr 09, 2009 12:00 am

This is for the modification that was made. Custom profile field would only give you text. Genders has the icon and displays board wide so is a much better option.

User avatar
MadFly
Forum Member
Forum Member
Posts: 24
Joined: Wed Apr 08, 2009 10:46 pm

Re: Add Genders option on register phpBB3

Post by MadFly » Thu Apr 09, 2009 6:46 am

Ah I see. Now I understand. :grin:

User avatar
cisco007
Staff
Staff
Posts: 501
Joined: Tue Oct 07, 2008 3:44 am

Re: Add Genders option on register phpBB3

Post by cisco007 » Thu Apr 09, 2009 12:49 pm

great, just installed it, it works just like a thought it would. Thanks! :good:

Post Reply