You are here

function _user_resource_delete in Services 7.3

Same name and namespace in other branches
  1. 6.3 resources/user_resource.inc \_user_resource_delete()

Delete a user.

Parameters

$uid: UID of the user to be deleted.

See also

user_delete()

1 string reference to '_user_resource_delete'
_user_resource_definition in resources/user_resource.inc

File

resources/user_resource.inc, line 537

Code

function _user_resource_delete($uid) {
  if ($uid == 1) {
    return services_error(t('The admin user cannot be deleted.'), 403);
  }
  $account = user_load($uid);
  if (empty($account)) {
    return services_error(t('There is no user with ID @uid.', array(
      '@uid' => $uid,
    )), 404);
  }
  user_delete($uid);

  // Everything went right.
  return TRUE;
}