Closed (fixed)
Project:
Services
Version:
6.x-2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Apr 2010 at 09:36 UTC
Updated:
7 Jun 2010 at 17:41 UTC
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
Comment #1
skyredwangCould you describe "generate a bug"? since you also quote some codes above, do you have any suggestions? or maybe even a patch?
Comment #2
gddI've just tested this and it works fine. There are no issues.
Comment #4
nicolicioiu.liviu commentedAt 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.