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

View File

@ -44,6 +44,7 @@
'city' => array('name' => 'City'), 'city' => array('name' => 'City'),
'province' => array('name' => 'Province'), 'province' => array('name' => 'Province'),
'organization' => array('name' => 'Organization'), 'organization' => array('name' => 'Organization'),
'sex' => array('name' => 'Gender'),
'phonehome' => array('name' => 'Phone (Home)', 'phonehome' => array('name' => 'Phone (Home)',
'regexp' => '^[1-9][0-9]{2}-[1-9][0-9]{2}-[0-9]{4}( x[0-9]{1,5})?$', '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\'',), 'format' => '\'NNN-NNN-NNNN\' or \'NNN-NNN-NNNN xEXT\'',),
@ -285,7 +286,21 @@ item($u, 'phonework');
echo "</tr>"; echo "</tr>";
echo "<tr>\n"; echo "<tr>\n";
item($u, 'fax'); 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>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>"; echo "<tr><td colspan=\"4\"><hr /></td></tr>";