You are here

function flickr_admin_settings_submit in Flickr 5

Same name and namespace in other branches
  1. 6 flickr.admin.inc \flickr_admin_settings_submit()
  2. 7 flickr.admin.inc \flickr_admin_settings_submit()

File

./flickr.module, line 165

Code

function flickr_admin_settings_submit($form_id, $form) {

  // clean up the data ...
  $form['flickr_api_key'] = trim($form['flickr_api_key']);
  $form['flickr_api_secret'] = trim($form['flickr_api_secret']);
  $form['flickr_default_userid'] = trim($form['flickr_default_userid']);

  // ... replace the usernames with a user id ...
  if (!flickr_is_nsid($form['flickr_default_userid'])) {
    $username = $form['flickr_default_userid'];
    if ($user = flickr_user_find_by_username($username)) {
      drupal_set_message(t("The Flickr username %username has been replaced with the corresponding user id %uid.", array(
        '%username' => $form['flickr_default_userid'],
        '%uid' => $user['id'],
      )));
      $form['flickr_default_userid'] = $user['id'];
    }
  }

  // ... and save the settings
  system_settings_form_submit($form_id, $form);
}