diff --git a/account.inc.php b/account.inc.php index 92344c2..d61f98f 100644 --- a/account.inc.php +++ b/account.inc.php @@ -133,24 +133,27 @@ function account_load_by_username($username) function account_create($username,$password=NULL) { global $config; + $errMsg = ''; /* Sanity check username */ if(!account_valid_user($username)) { - return i18n("Invalid user name \"%1\"", array($username)); - } - - /* Make sure the user doesn't exist */ - $us = mysql_real_escape_string($username); - $q = mysql_query("SELECT * FROM accounts WHERE username='$us'"); - if(mysql_num_rows($q)) { - return i18n("The username %1 is already in use", array($username)); + $errMsg .= i18n('Invalid user name "%1"', array($username)) . " "; + }else{ + /* Make sure the user doesn't exist */ + $us = mysql_real_escape_string($username); + $q = mysql_query("SELECT * FROM accounts WHERE username='$us'"); + if(mysql_num_rows($q)) { + $errMsg .= i18n("The username %1 is already in use", array($username)) . " "; + } } //if the password is set, make sure its valid, if its null, thats OK, it'll get generated and set by account_set_password if($password && !account_valid_password($password)) { - return i18n("Invalid password"); + $errMsg .= i18n("Invalid password") . " "; } + if($errMsg != '') return $errMsg; + /* Create the account */ mysql_query("INSERT INTO accounts (`username`,`created`,`deleted`,`superuser`) VALUES ('$us', NOW(),'no','no')"); diff --git a/testapi.php b/testapi.php index 65e025c..7a52636 100644 --- a/testapi.php +++ b/testapi.php @@ -98,6 +98,14 @@ email:
Link username to email? Yes       No
+

Create an account:
+
+username:
+password:
+email address:
+ +
+

Teacher Specific Commands

Science Olympic Teams List
@@ -142,6 +150,8 @@ role id:
+ +

Event Schedule

Schedule Listing
diff --git a/user.inc.php b/user.inc.php index c48f863..b80a4ea 100644 --- a/user.inc.php +++ b/user.inc.php @@ -342,7 +342,6 @@ function user_get_field_info($noConference = false){ 'firstaid' => array('label' => 'First Aid', 'group' => 'Personal Information'), 'cpr' => array('label' => 'CPR', 'group' => 'Personal Information'), 'displayemail' => array('label' => 'Display Email', 'group' => 'Personal Information'), - 'languages' => array('label' => 'Spoken Languages', 'group' => 'Judges'), 'sponsors_id' => array('label' => 'Sponsor', 'group' => 'Sponsors'), 'primary' => array('label' => 'Primary Contact', 'group' => 'Sponsors'), 'position' => array('label' => 'Position', 'group' => 'Sponsors'), @@ -380,9 +379,11 @@ function user_get_field_info($noConference = false){ $returnval['expertise_other'] = array('label' => 'Other areas of expertise', 'group' => 'Judges'); $returnval['available_times'] = array('label' => 'Times Available', 'group' => 'Judges'); $returnval['available_events'] = array('label' => 'Event Availability', 'group' => 'Volunteers'); + $returnval['languages'] = array('label' => 'Spoken Languages', 'group' => 'Judges'); break; case 'scienceolympics': $returnval['available_events'] = array('label' => 'Event Availability', 'group' => 'Judges,Volunteers'); + $returnval['languages'] = array('label' => 'Spoken Languages', 'group' => 'Judges,Volunteers'); break; } }