If is used user.delete this generate a bug:

/**
* Delete a user.
*
* @param $uid
* UID of the user to be deleted.
*
* @see user_delete()
*/
function user_service_delete($uid) {
$account = user_load($uid);
if (empty($account)) {
return services_error(t('There is no user with such ID.'), 404);
}
user_delete($account, $uid);

// Everything went right.
return TRUE;
}

Function user_delete receive an account object and this use an array,
http://api.drupal.org/api/function/user_delete/6

Comments

skyredwang’s picture

Status: Active » Postponed (maintainer needs more info)

Could you describe "generate a bug"? since you also quote some codes above, do you have any suggestions? or maybe even a patch?

gdd’s picture

Status: Postponed (maintainer needs more info) » Fixed

I've just tested this and it works fine. There are no issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nicolicioiu.liviu’s picture

At the end of function user_delete all modules wich implement hook user and
and catch delete operation :
function user_delete($edit, $uid) {
$account = user_load(array('uid' => $uid));
sess_destroy_uid($uid);
_user_mail_notify('status_deleted', $account);
db_query('DELETE FROM {users} WHERE uid = %d', $uid);
db_query('DELETE FROM {users_roles} WHERE uid = %d', $uid);
db_query('DELETE FROM {authmap} WHERE uid = %d', $uid);
$variables = array('%name' => $account->name, '%email' => '<'. $account->mail .'>');
watchdog('user', 'Deleted user: %name %email.', $variables, WATCHDOG_NOTICE);
user_module_invoke('delete', $edit, $account);
}

Usualy $edit is array not an object and this could generate a fatal error.
In custom drupal module, $edit is an array not an object.