|
|
|
|
@ -223,7 +223,7 @@ class UserManager |
|
|
|
|
$expirationDate = null, |
|
|
|
|
$active = 1, |
|
|
|
|
$hr_dept_id = 0, |
|
|
|
|
$extra = null, |
|
|
|
|
$extra = [], |
|
|
|
|
$encrypt_method = '', |
|
|
|
|
$send_mail = false, |
|
|
|
|
$isAdmin = false, |
|
|
|
|
@ -383,12 +383,25 @@ class UserManager |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_multiple_access_url()) { |
|
|
|
|
UrlManager::add_user_to_url($return, api_get_current_access_url_id()); |
|
|
|
|
UrlManager::add_user_to_url($userId, api_get_current_access_url_id()); |
|
|
|
|
} else { |
|
|
|
|
//we are adding by default the access_url_user table with access_url_id = 1 |
|
|
|
|
UrlManager::add_user_to_url($return, 1); |
|
|
|
|
UrlManager::add_user_to_url($userId, 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (is_array($extra) && count($extra) > 0) { |
|
|
|
|
foreach ($extra as $fname => $fvalue) { |
|
|
|
|
self::update_extra_field_value($userId, $fname, $fvalue); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// Create notify settings by default |
|
|
|
|
self::update_extra_field_value($userId, 'mail_notify_invitation', '1'); |
|
|
|
|
self::update_extra_field_value($userId, 'mail_notify_message', '1'); |
|
|
|
|
self::update_extra_field_value($userId, 'mail_notify_group_message', '1'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
self::update_extra_field_value($userId, 'already_logged_in', 'false'); |
|
|
|
|
|
|
|
|
|
if (!empty($email) && $send_mail) { |
|
|
|
|
$recipient_name = api_get_person_name( |
|
|
|
|
$firstName, |
|
|
|
|
@ -483,29 +496,21 @@ class UserManager |
|
|
|
|
} |
|
|
|
|
/* ENDS MANAGE EVENT WITH MAIL */ |
|
|
|
|
} |
|
|
|
|
Event::addEvent(LOG_USER_CREATE, LOG_USER_ID, $return); |
|
|
|
|
|
|
|
|
|
if (!empty($hook)) { |
|
|
|
|
$hook->setEventData(array( |
|
|
|
|
'return' => $userId, |
|
|
|
|
'originalPassword' => $original_password |
|
|
|
|
)); |
|
|
|
|
$hook->notifyCreateUser(HOOK_EVENT_TYPE_POST); |
|
|
|
|
} |
|
|
|
|
Event::addEvent(LOG_USER_CREATE, LOG_USER_ID, $userId); |
|
|
|
|
} else { |
|
|
|
|
Display::addFlash(Display::return_message(get_lang('ErrorContactPlatformAdmin'))); |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (is_array($extra) && count($extra) > 0) { |
|
|
|
|
$res = true; |
|
|
|
|
foreach ($extra as $fname => $fvalue) { |
|
|
|
|
$res = $res && self::update_extra_field_value($return, $fname, $fvalue); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
self::update_extra_field_value($return, 'already_logged_in', 'false'); |
|
|
|
|
|
|
|
|
|
if (!empty($hook)) { |
|
|
|
|
$hook->setEventData(array( |
|
|
|
|
'return' => $return, |
|
|
|
|
'originalPassword' => $original_password |
|
|
|
|
)); |
|
|
|
|
$hook->notifyCreateUser(HOOK_EVENT_TYPE_POST); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|