|
|
|
@ -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]; |
|
|
|
|