Fix Drupal user creation - refs BT#9413

1.10.x
Angel Fernando Quiroz Campos 10 years ago
parent 57ac01ffcb
commit e8c03a803a
  1. 8
      main/webservices/registration.soap.php
  2. 11
      plugin/createdrupaluser/src/HookCreateDrupalUser.php

@ -569,6 +569,10 @@ function WSCreateUser($params) {
active = '".Database::escape_string($active)."'";
$result = Database::query($sql);-*/
if (isset($original_user_id_name) && isset($original_user_id_value)) {
$_SESSION['ws_' . $original_user_id_name] = $original_user_id_value;
}
/** @var User $user */
$userId = UserManager::create_user(
$firstName,
@ -613,6 +617,10 @@ function WSCreateUser($params) {
$original_user_id_value
);
if (isset($original_user_id_name) && isset($original_user_id_value)) {
unset($_SESSION['ws_' . $original_user_id_name]);
}
if (is_array($extra_list) && count($extra_list) > 0) {
foreach ($extra_list as $extra) {
$extra_field_name = $extra['field_name'];

@ -54,7 +54,16 @@ class HookCreateDrupalUser extends HookObserver implements HookCreateUserObserve
);
$client = new SoapClient(null, $options);
$drupalUserId = $client->addUser($fields, $extraFields);
if (isset($_SESSION['ws_drupal_user_id'])) {
$drupalUserId = $_SESSION['ws_drupal_user_id'];
return true;
}
if ($drupalUserId === false) {
$drupalUserId = $client->addUser($fields, $extraFields);
}
if ($drupalUserId !== false) {
UserManager::update_extra_field_value($return, 'drupal_user_id', $drupalUserId);
}

Loading…
Cancel
Save