Validate the field extra that it is not required

1.9.x
FraGoTe 11 years ago committed by Yannick Warnier
parent 8a12bbc2b0
commit 43949c7bb4
  1. 10
      main/webservices/webservice_user.php

@ -219,16 +219,18 @@ class WSUser extends WS {
* @param array Extra fields. An array with elements of the form ('field_name' => 'name_of_the_field', 'field_value' => 'value_of_the_field').
* @return mixed New user id generated by the system, WSError otherwise
*/
protected function createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras) {
protected function createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras = array()) {
global $api_failureList;
// Add the original user id field name and value to the extra fields if needed
$extras_associative = array();
if($user_id_field_name != "chamilo_user_id") {
$extras_associative[$user_id_field_name] = $user_id_value;
}
foreach($extras as $extra) {
$extras_associative[$extra['field_name']] = $extra['field_value'];
}
if (!empty($extras)) {
foreach($extras as $extra) {
$extras_associative[$extra['field_name']] = $extra['field_value'];
}
}
$result = UserManager::create_user($firstname, $lastname, $status, $email, $login, $password, '', $language, $phone, '', PLATFORM_AUTH_SOURCE, $expiration_date, $visibility, 0, $extras_associative, $encrypt_method);
if (!$result) {
$failure = $api_failureList[0];

Loading…
Cancel
Save