Gender hack Select Pulldown Menus.

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
I hate that you have to put the 0s and stuff in when you register. It just confuses people. It would be so much easier to have a pulldown menu. If someone writes this out I'll edit the Birthday Hack and put it in a zip file. Would this be easy to do? Thanks, John

You can find the entire file here... [ Register or login to view links on this board.]
Heres what the code looks like in the usercp_registration.php file in the includes file.
// find the birthday values, reflected by the $lang['Submit_date_format']
if ($birthday || !$board_config['min_user_age']) //if a birthday is submited, then validate it
{
   for ($i=0;$i<=strlen($lang['Submit_date_format']);$i++)
   {
      switch ($lang['Submit_date_format'][$i])
      {
        case d:   $day=$birthday_lengt;$date_count++;
         $birthday_lengt++;break;
        case m:   $md=$birthday_lengt;$date_count++;
         $birthday_lengt++;break;
       case Y:   $year=$birthday_lengt;$date_count++;
         $birthday_lengt=$birthday_lengt+3;break;
      }
      $birthday_lengt++;
   }
   // did we find both day,month and year
   if ($date_count<3)
   {
      $error = TRUE;
      if( isset($error_msg) )$error_msg .= "<br />";
      $error_msg .= $lang['Wrong_birthday_format'];
   } else
   {
      $day=$birthday[$day].$birthday[$day+1];
      $md=$birthday[$md].$birthday[$md+1];
      $year=$birthday[$year].$birthday[$year+1].$birthday[$year+2].$birthday[$year+3];
      $user_age=(date('md')>=$md.$day) ? date('Y') - $year : date('Y') - $year - 1 ;
      // Check maximum user age
      if ($user_age>$board_config['max_user_age']) $md=13  ;
      // Check minimum user age
      if ($user_age<$board_config['min_user_age']) $md=13  ;
      if (!checkdate($md,$day,$year))
      {
         $error = TRUE;
         if( isset($error_msg) )$error_msg .= "<br />";
         $error_msg .= $lang['Not_old_enough'];
      } else
      {
         $birthday = ($error) ? $birthday : mkrealdate($day,$md,$year);
         $next_birthday_greeting = (date('md')<$md.$day) ? date('Y'):date('Y')+1 ;
      }
   }   
} else $birthday = ($error) ? '' : 999999;


<tr>
   <td class="row1"><span class="gen">{L_BIRTHDAY}:</span><br /><span class="gensmall">{L_BIRTHDAY_EXPLAIN}<br /></span></td>
   <td class="row2"><input type="text" class="post"style="width: 80px"  name="birthday" size="10" maxlength="10" value="{BIRTHDAY}" /></td>
</tr>
TPL CODE
I'd like the registration and edit forms to look something like this.....
<tr align="left">
    <td>Birth Date:</td>
    <td>
      <select name="registration[birth_month]">
        <option value=""></option>
        <option value="01" >Jan.</option>
        <option value="02" >Feb.</option>
        <option value="03" >Mar.</option>
        <option value="04" >Apr.</option>
        <option value="05" >May</option>
        <option value="06" >June</option>
        <option value="07" >July</option>
        <option value="08" >Aug.</option>
        <option value="09" >Sep.</option>
        <option value="10" >Oct.</option>
        <option value="11" >Nov.</option>
        <option value="12" >Dec.</option>
      </select>
      <select name="registration[birth_day]">
        <option value=""></option>
      <option value="01" >1</option>
<option value="02" >2</option>
<option value="03" >3</option>
<option value="04" >4</option>
<option value="05" >5</option>
<option value="06" >6</option>
<option value="07" >7</option>
<option value="08" >8</option>
<option value="09" >9</option>
<option value="10" >10</option>
<option value="11" >11</option>
<option value="12" >12</option>
<option value="13" >13</option>
<option value="14" >14</option>
<option value="15" >15</option>
<option value="16" >16</option>
<option value="17" >17</option>
<option value="18" >18</option>
<option value="19" >19</option>
<option value="20" >20</option>
<option value="21" >21</option>
<option value="22" >22</option>
<option value="23" >23</option>
<option value="24" >24</option>
<option value="25" >25</option>
<option value="26" >26</option>
<option value="27" >27</option>
<option value="28" >28</option>
<option value="29" >29</option>
<option value="30" >30</option>
<option value="31" >31</option>
      </select>,
      <select name="registration[birth_year]">
        <option value=""></option>
      <option value="1988" >1988</option>
<option value="1987" >1987</option>
<option value="1986" >1986</option>
<option value="1985" >1985</option>
<option value="1984" >1984</option>
<option value="1983" >1983</option>
<option value="1982" >1982</option>
<option value="1981" >1981</option>
<option value="1980" >1980</option>
<option value="1979" >1979</option>
<option value="1978" >1978</option>
<option value="1977" >1977</option>
<option value="1976" >1976</option>
<option value="1975" >1975</option>
<option value="1974" >1974</option>
<option value="1973" >1973</option>
<option value="1972" >1972</option>
<option value="1971" >1971</option>
<option value="1970" >1970</option>
<option value="1969" >1969</option>
<option value="1968" >1968</option>
<option value="1967" >1967</option>
<option value="1966" >1966</option>
<option value="1965" >1965</option>
<option value="1964" >1964</option>
<option value="1963" >1963</option>
<option value="1962" >1962</option>
<option value="1961" >1961</option>
<option value="1960" >1960</option>
<option value="1959" >1959</option>
<option value="1958" >1958</option>
<option value="1957" >1957</option>
<option value="1956" >1956</option>
<option value="1955" >1955</option>
<option value="1954" >1954</option>
<option value="1953" >1953</option>
<option value="1952" >1952</option>
<option value="1951" >1951</option>
<option value="1950" >1950</option>
<option value="1949" >1949</option>
<option value="1948" >1948</option>
<option value="1947" >1947</option>
<option value="1946" >1946</option>
<option value="1945" >1945</option>
<option value="1944" >1944</option>
<option value="1943" >1943</option>
<option value="1942" >1942</option>
<option value="1941" >1941</option>
<option value="1940" >1940</option>
<option value="1939" >1939</option>
<option value="1938" >1938</option>
<option value="1937" >1937</option>
<option value="1936" >1936</option>
<option value="1935" >1935</option>
<option value="1934" >1934</option>
<option value="1933" >1933</option>
<option value="1932" >1932</option>
<option value="1931" >1931</option>
<option value="1930" >1930</option>
<option value="1929" >1929</option>
<option value="1928" >1928</option>
<option value="1927" >1927</option>
<option value="1926" >1926</option>
<option value="1925" >1925</option>
<option value="1924" >1924</option>
<option value="1923" >1923</option>
<option value="1922" >1922</option>
<option value="1921" >1921</option>
<option value="1920" >1920</option>
<option value="1919" >1919</option>
<option value="1918" >1918</option>
<option value="1917" >1917</option>
<option value="1916" >1916</option>
<option value="1915" >1915</option>
<option value="1914" >1914</option>
<option value="1913" >1913</option>
<option value="1912" >1912</option>
<option value="1911" >1911</option>
<option value="1910" >1910</option>
<option value="1909" >1909</option>
<option value="1908" >1908</option>
<option value="1907" >1907</option>
<option value="1906" >1906</option>
<option value="1905" >1905</option>
<option value="1904" >1904</option>
<option value="1903" >1903</option>
<option value="1902" >1902</option>
<option value="1901" >1901</option>
<option value="1900" >1900</option>
      </select>
    </td>
  </tr>



Back to top Reply with quote
#2   re: Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
I just looked and it seems like you have already done this. Are you willing to share? Because typing in 05-05-1982 sucks. Id rather have pulldowns so my users don't get confused and pissed and don't come to my site anymore.



Back to top Reply with quote
#3   re: Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
I see you have something like this....... Could you please share with me how to fix this right?

<!-- Start add - Birthday MOD -->
   <tr>
     <td class="row1"><span class="explaintitle">Birthday:</span></td>
     <td class="row2"><span class="genmed">Day&nbsp;</span><select name="b_day" size="1" class="gensmall">
      <option value="0">&nbsp;-&nbsp;</option>
      <option value="1">&nbsp;1&nbsp;</option>
      <option value="2">&nbsp;2&nbsp;</option>
      <option value="3">&nbsp;3&nbsp;</option>
      <option value="4">&nbsp;4&nbsp;</option>
      <option value="5">&nbsp;5&nbsp;</option>
      <option value="6">&nbsp;6&nbsp;</option>
      <option value="7">&nbsp;7&nbsp;</option>
      <option value="8">&nbsp;8&nbsp;</option>
      <option value="9">&nbsp;9&nbsp;</option>
      <option value="10">&nbsp;10&nbsp;</option>
      <option value="11">&nbsp;11&nbsp;</option>
      <option value="12">&nbsp;12&nbsp;</option>
      <option value="13">&nbsp;13&nbsp;</option>
      <option value="14">&nbsp;14&nbsp;</option>
      <option value="15">&nbsp;15&nbsp;</option>
      <option value="16">&nbsp;16&nbsp;</option>
      <option value="17">&nbsp;17&nbsp;</option>
      <option value="18">&nbsp;18&nbsp;</option>
      <option value="19">&nbsp;19&nbsp;</option>
      <option value="20">&nbsp;20&nbsp;</option>
      <option value="21">&nbsp;21&nbsp;</option>
      <option value="22">&nbsp;22&nbsp;</option>
      <option value="23">&nbsp;23&nbsp;</option>
      <option value="24">&nbsp;24&nbsp;</option>
      <option value="25">&nbsp;25&nbsp;</option>
      <option value="26">&nbsp;26&nbsp;</option>
      <option value="27">&nbsp;27&nbsp;</option>
      <option value="28">&nbsp;28&nbsp;</option>
      <option value="29">&nbsp;29&nbsp;</option>
      <option value="30">&nbsp;30&nbsp;</option>
      <option value="31">&nbsp;31&nbsp;</option>
        </select>&nbsp;&nbsp;<span class="genmed">Month&nbsp;</span><select name="b_md" size="1" class="gensmall">
           <option value="0">&nbsp;-&nbsp;</option>
      <option value="1">&nbsp;January&nbsp;</option>
      <option value="2">&nbsp;February&nbsp;</option>
      <option value="3">&nbsp;March&nbsp;</option>
      <option value="4">&nbsp;April&nbsp;</option>
      <option value="5">&nbsp;May&nbsp;</option>
      <option value="6">&nbsp;June&nbsp;</option>
      <option value="7">&nbsp;July&nbsp;</option>
      <option value="8">&nbsp;August&nbsp;</option>
      <option value="9">&nbsp;September&nbsp;</option>
      <option value="10">&nbsp;October&nbsp;</option>
      <option value="11">&nbsp;November&nbsp;</option>
      <option value="12">&nbsp;December&nbsp;</option>
      </select>&nbsp;&nbsp;<span class="genmed">Year&nbsp;</span><input type="text" class="post" style="width: 50px" name="b_year" size="4" maxlength="4" value="" />&nbsp;&nbsp;</td>
   </tr>
<!-- End add - Birthday MOD -->



Back to top Reply with quote
#4   re: Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
How much do i have to donate to get this workin? It's kind of essential for my website.... I'll lose members If I don't get it.



Back to top Reply with quote
#5   re: Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
Well i figured it out now I just edited the add_body.tpl files and added the noted code.

<td>Birth Date:</td>
    <td>
      <select name="day   ">
        <option value=""></option>
        <option value="01" >Jan.</option>
        <option value="02" >Feb.</option>
        <option value="03" >Mar.</option>
        <option value="04" >Apr.</option>
        <option value="05" >May</option>
        <option value="06" >June</option>
        <option value="07" >July</option>
        <option value="08" >Aug.</option>
        <option value="09" >Sep.</option>
        <option value="10" >Oct.</option>
        <option value="11" >Nov.</option>
        <option value="12" >Dec.</option>
      </select>
      <select name="month">
        <option value=""></option>
      <option value="01" >1</option>
<option value="02" >2</option>
<option value="03" >3</option>
<option value="04" >4</option>
<option value="05" >5</option>
<option value="06" >6</option>
<option value="07" >7</option>
<option value="08" >8</option>
<option value="09" >9</option>
<option value="10" >10</option>
<option value="11" >11</option>
<option value="12" >12</option>
<option value="13" >13</option>
<option value="14" >14</option>
<option value="15" >15</option>
<option value="16" >16</option>
<option value="17" >17</option>
<option value="18" >18</option>
<option value="19" >19</option>
<option value="20" >20</option>
<option value="21" >21</option>
<option value="22" >22</option>
<option value="23" >23</option>
<option value="24" >24</option>
<option value="25" >25</option>
<option value="26" >26</option>
<option value="27" >27</option>
<option value="28" >28</option>
<option value="29" >29</option>
<option value="30" >30</option>
<option value="31" >31</option>
      </select>,
      <select name="year">
        <option value=""></option>
      <option value="1988" >1988</option>
<option value="1987" >1987</option>
<option value="1986" >1986</option>
<option value="1985" >1985</option>
<option value="1984" >1984</option>
<option value="1983" >1983</option>
<option value="1982" >1982</option>
<option value="1981" >1981</option>
<option value="1980" >1980</option>
<option value="1979" >1979</option>
<option value="1978" >1978</option>
<option value="1977" >1977</option>
<option value="1976" >1976</option>
<option value="1975" >1975</option>
<option value="1974" >1974</option>
<option value="1973" >1973</option>
<option value="1972" >1972</option>
<option value="1971" >1971</option>
<option value="1970" >1970</option>
<option value="1969" >1969</option>
<option value="1968" >1968</option>
<option value="1967" >1967</option>
<option value="1966" >1966</option>
<option value="1965" >1965</option>
<option value="1964" >1964</option>
<option value="1963" >1963</option>
<option value="1962" >1962</option>
<option value="1961" >1961</option>
<option value="1960" >1960</option>
<option value="1959" >1959</option>
<option value="1958" >1958</option>
<option value="1957" >1957</option>
<option value="1956" >1956</option>
<option value="1955" >1955</option>
<option value="1954" >1954</option>
<option value="1953" >1953</option>
<option value="1952" >1952</option>
<option value="1951" >1951</option>
<option value="1950" >1950</option>
<option value="1949" >1949</option>
<option value="1948" >1948</option>
<option value="1947" >1947</option>
<option value="1946" >1946</option>
<option value="1945" >1945</option>
<option value="1944" >1944</option>
<option value="1943" >1943</option>
<option value="1942" >1942</option>
<option value="1941" >1941</option>
<option value="1940" >1940</option>
<option value="1939" >1939</option>
<option value="1938" >1938</option>
<option value="1937" >1937</option>
<option value="1936" >1936</option>
<option value="1935" >1935</option>
<option value="1934" >1934</option>
<option value="1933" >1933</option>
<option value="1932" >1932</option>
<option value="1931" >1931</option>
<option value="1930" >1930</option>
<option value="1929" >1929</option>
<option value="1928" >1928</option>
<option value="1927" >1927</option>
<option value="1926" >1926</option>
<option value="1925" >1925</option>
<option value="1924" >1924</option>
<option value="1923" >1923</option>
<option value="1922" >1922</option>
<option value="1921" >1921</option>
<option value="1920" >1920</option>
<option value="1919" >1919</option>
<option value="1918" >1918</option>
<option value="1917" >1917</option>
<option value="1916" >1916</option>
<option value="1915" >1915</option>
<option value="1914" >1914</option>
<option value="1913" >1913</option>
<option value="1912" >1912</option>
<option value="1911" >1911</option>
<option value="1910" >1910</option>
<option value="1909" >1909</option>
<option value="1908" >1908</option>
<option value="1907" >1907</option>
<option value="1906" >1906</option>
<option value="1905" >1905</option>
<option value="1904" >1904</option>
<option value="1903" >1903</option>
<option value="1902" >1902</option>
<option value="1901" >1901</option>
<option value="1900" >1900</option>
      </select>
    </td>
  </tr>
</td>
</tr>



This part I won't be able to figure out because I don't know php...

How do i get the date to stay the same when the user goes to edit their profile. Like put selected in that line they already chose.

So far no help. icon_sad.gif I wonder if someone can help me with this one.


Back to top Reply with quote
#6   re: Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
What would be better is if you could tell me how to make it so the Birthdate Is required and then remove the birthdate edit from the edit profile area.



Back to top Reply with quote
#7   Re: re: Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   


Originally posted by ledzeppelin @ Tue Oct 05, 2004 11:34 am:

What would be better is if you could tell me how to make it so the Birthdate Is required and then remove the birthdate edit from the edit profile area.



Ok im almost there now... [ Register or login to view links on this board. ] shows how to make fields required. Now how do i make it so birthdate doesn't showup in the edit profile part.

Any help this time?



Back to top Reply with quote
#8   Re: re: Gender hack Select Pulldown Menus.
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
woops.... EDIT



Back to top Reply with quote
#9   GENDER HACK I'M ALMOST THERE....
ledzeppelin
CZ Newbie
ledzeppelin has been a member for over 20 year's 20 Year Member
usa.gif indiana.gif
Age: 42
Gender: Male
Fav. Sports Team: UMMMMMMMM
Status: Offline
Joined: Sep 16, 2004
0.00 posts per day
Posts: 23
Points: 3,373
   
Ok im almost there now... [ Register or login to view links on this board. ] shows how to make fields required. Now how do i make it so birthdate doesn't showup in the edit profile part.



Back to top Reply with quote
#10   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,475
   
Sorry I missed this post it has been along time since I installed that hack. But I do not recall making any special changes for the dropdown.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum