You are here

function user_service_save in Services 7

Same name and namespace in other branches
  1. 6 services/user_service/user_service.inc \user_service_save()
  2. 6.2 services/user_service/user_service.inc \user_service_save()

Save user details.

Parameters

$user_data: Object. The user object with all user data.

1 string reference to 'user_service_save'
user_service_service in services/user_service/user_service.module
Implementation of hook_service().

File

services/user_service/user_service.inc, line 126
@author Services Dev Team

Code

function user_service_save($account) {

  // if uid is present then update, otherwise insert
  $update = user_load($account['uid']);
  $account = isset($update->uid) ? user_save($update, $account) : user_save('', $account);
  if (!$account) {
    return services_error(t('Error on saving the user.'), 500);
  }

  // Everything went right.
  // Return the user ID
  return $account->uid;
}