You are here

function flickr_user_presave in Flickr 7

Implements hook_user_presave().

File

./flickr.module, line 266
The Flickr module.

Code

function flickr_user_presave(&$edit, $account, $category) {
  if (isset($edit['flickr_identifier'])) {
    db_delete('flickr_users')
      ->condition('uid', $account->uid)
      ->execute();

    // $user_affected = db_affected_rows();
    if (!empty($edit['flickr_identifier'])) {
      $id = db_insert('flickr_users')
        ->fields(array(
        'uid' => $account->uid,
        'nsid' => flickr_user_find_by_identifier($edit['flickr_identifier']),
        'identifier' => $edit['flickr_identifier'],
      ))
        ->execute();
    }

    /*
    elseif ($user_affected) {
      //Flickr account deleted
      drupal_set_message(t("%username's Flickr page has been deleted.", array('%username' => $account->name)));
    }
    */
  }
  $edit['flickr_identifier'] = NULL;
}