Add the missing 'Gender' field to the user personal profile page, as well as save it :)

This commit is contained in:
james 2008-02-15 23:08:33 +00:00
parent e0a0e3dbcf
commit a118acc21c
2 changed files with 17 additions and 3 deletions

View File

@ -219,7 +219,7 @@ function user_save($u)
$fields = array('firstname','lastname','username','password',
'email',
'phonehome','phonework','phonecell','fax','organization',
'address','address2','city','province','postalcode');
'address','address2','city','province','postalcode',"sex");
$set = "";
foreach($fields as $f) {
@ -497,7 +497,6 @@ function user_personal_required_fields($type)
* - address2
*/
$ret = array_diff($ret, array('address2'));
return $ret;
}

View File

@ -44,6 +44,7 @@
'city' => array('name' => 'City'),
'province' => array('name' => 'Province'),
'organization' => array('name' => 'Organization'),
'sex' => array('name' => 'Gender'),
'phonehome' => array('name' => 'Phone (Home)',
'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$',
'format' => '\'NNN-NNN-NNNN\' or \'NNN-NNN-NNNN xEXT\'',),
@ -285,7 +286,21 @@ item($u, 'phonework');
echo "</tr>";
echo "<tr>\n";
item($u, 'fax');
echo '<td></td><td></td>';
if(in_array('sex', $fields)) {
echo '<td>'.i18n('Gender').': </td>';
echo '<td>';
echo "<select name=\"sex\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
if($u['sex']=="male") $sel="selected=\"selected\""; else $sel="";
echo "<option value=\"male\" $sel>".i18n("Male")."</option>\n";
if($u['sex']=="female") $sel="selected=\"selected\""; else $sel="";
echo "<option value=\"female\" $sel>".i18n("Female")."</option>\n";
echo "</select>";
if(in_array('sex', $required)) echo REQUIREDFIELD;
echo '</td>';
} else {
echo '<td></td><td></td>';
}
echo "</tr>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>";