forked from science-ation/science-ation
- Make the default username == to the email address
- Remove required field 'username' - Put a little note beside the username to encourage most people to just leave it alone.
This commit is contained in:
parent
a2105c30f4
commit
75669d9c08
@ -64,7 +64,6 @@
|
|||||||
/* If the editer is super, let them see/edit/save the user/pass */
|
/* If the editer is super, let them see/edit/save the user/pass */
|
||||||
$fields[] = 'username';
|
$fields[] = 'username';
|
||||||
$fields[] = 'password';
|
$fields[] = 'password';
|
||||||
$required[] = 'username';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_POST['action']=="save")
|
if($_POST['action']=="save")
|
||||||
@ -74,6 +73,10 @@
|
|||||||
$u[$f] = mysql_escape_string(stripslashes($_POST[$f]));
|
$u[$f] = mysql_escape_string(stripslashes($_POST[$f]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!array_key_exists('username', $u) || $u['username'] == '') {
|
||||||
|
$u['username'] = $u['email'];
|
||||||
|
}
|
||||||
|
|
||||||
if(in_array('committee', $u['types'])) {
|
if(in_array('committee', $u['types'])) {
|
||||||
/* Trying to save a committee member eh? Well, we established above
|
/* Trying to save a committee member eh? Well, we established above
|
||||||
* that we're allowed to be here, so go ahead and save it */
|
* that we're allowed to be here, so go ahead and save it */
|
||||||
@ -152,12 +155,14 @@ if(count($u['types']) > 1) {
|
|||||||
echo notice(i18n('This user has multiple roles, the fields shown below are a combination of every role. Some may not apply to some roles. This user has the following roles:').' '.$roles);
|
echo notice(i18n('This user has multiple roles, the fields shown below are a combination of every role. Some may not apply to some roles. This user has the following roles:').' '.$roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
function item($user, $text, $fname)
|
function item($user, $text, $fname, $subtext='')
|
||||||
{
|
{
|
||||||
global $fields, $required;
|
global $fields, $required;
|
||||||
|
|
||||||
if(in_array($fname, $fields)) {
|
if(in_array($fname, $fields)) {
|
||||||
echo '<td>'.i18n($text).': </td>';
|
echo '<td>'.i18n($text).': ';
|
||||||
|
if($subtext != '') echo '<br /><span style="font-size: 0.5em;">'.i18n($subtext).'</span>';
|
||||||
|
echo '</td>';
|
||||||
echo "<td><input onchange=\"fieldChanged()\" type=\"text\" name=\"$fname\" value=\"{$user[$fname]}\" />";
|
echo "<td><input onchange=\"fieldChanged()\" type=\"text\" name=\"$fname\" value=\"{$user[$fname]}\" />";
|
||||||
if(in_array($fname, $required)) echo REQUIREDFIELD;
|
if(in_array($fname, $required)) echo REQUIREDFIELD;
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
@ -184,7 +189,7 @@ item($u, "Email Address", 'email');
|
|||||||
echo '<td></td><td></td>';
|
echo '<td></td><td></td>';
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
item($u, "Username", 'username');
|
item($u, "Username", 'username', '(if different from Email)');
|
||||||
item($u, "Password", 'password');
|
item($u, "Password", 'password');
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user