You are here

function _user_resource_update_services_user in Services 7.3

2 calls to _user_resource_update_services_user()
_user_resource_create in resources/user_resource.inc
Create a new user.
_user_resource_update in resources/user_resource.inc
Update an existing user.

File

resources/user_resource.inc, line 499

Code

function _user_resource_update_services_user($uid, $time) {

  //Determine if a row exists, if not that means we are creating the user,

  //If so that means we are updating it.
  $result = db_select('services_user', 'su')
    ->fields('su')
    ->condition('uid', $uid, '=')
    ->execute()
    ->fetchAssoc();

  //check the result
  if (!$result) {
    $id = db_insert('services_user')
      ->fields(array(
      'uid' => $uid,
      'created' => $time,
      'changed' => $time,
    ))
      ->execute();
  }
  else {
    db_update('services_user')
      ->fields(array(
      'uid' => $uid,
      'changed' => $time,
    ))
      ->condition('uid', $uid, '=')
      ->execute();
  }
}