Closed (won't fix)
Project:
Services
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
18 Jul 2009 at 17:10 UTC
Updated:
24 Nov 2009 at 04:32 UTC
Hi.
I suggest return uid if user exists, but uid is unknown.
Look at this code (file user_service.inc):
function user_service_save($account) {
// if uid is present then update, otherwise insert
$update = user_load($account['uid']);
+ // try to get user by mail if uid is unknown
+ if (!$update) {
+ $sql = 'select `uid` from {users} where `mail` = "%s"';
+ $u = db_fetch_array( db_query($sql, $account['mail']) );
+ if ($u['uid'] > 0) return $u['uid'];
+ }
$account = isset($update->uid) ? user_save($update,$account) : user_save('', $account);
if (!$account) {
return services_error(t('Error on saving the user.'));
}
// Everything went right.
// Return the user ID
return $account->uid;
}
Comments
Comment #1
marcingy commentedPlease supply a patch, code according to drupal standards and tidy up the code. Once this is done with feature request may be considered.
Comment #2
gdd