You are here

function flickr_admin_settings_submit in Flickr 6

Same name and namespace in other branches
  1. 5 flickr.module \flickr_admin_settings_submit()
  2. 7 flickr.admin.inc \flickr_admin_settings_submit()
1 string reference to 'flickr_admin_settings_submit'
flickr_admin_settings in ./flickr.admin.inc
Implements hook_settings().

File

./flickr.admin.inc, line 223

Code

function flickr_admin_settings_submit($form, &$form_state) {

  // Clean up the data.
  $form_state['values']['flickr_api_key'] = trim($form_state['values']['flickr_api_key']);
  $form_state['values']['flickr_api_secret'] = trim($form_state['values']['flickr_api_secret']);
  $form_state['values']['flickr_photos_per_page'] = trim($form_state['values']['flickr_photos_per_page']);
  $form_state['values']['flickr_default_userid'] = trim($form_state['values']['flickr_default_userid']);

  // Replace the usernames with a user id.
  // As emails or usernames might change, replace them with a unique nsid.
  if (!flickr_is_nsid($form_state['values']['flickr_default_userid'])) {
    $userid = $form_state['values']['flickr_default_userid'];
    if (empty($userid)) {
      return;
    }
    if ($user = flickr_user_find_by_identifier($userid)) {
      drupal_set_message(t("The Flickr user associated with '%userid' has internally been replaced with the corresponding Flickr ID '%uid'.", array(
        '%userid' => $form_state['values']['flickr_default_userid'],
        '%uid' => $user,
      )));
      $form_state['values']['flickr_default_userid'] = $user;
    }
  }
  else {
    $info = flickr_people_get_info($form_state['values']['flickr_default_userid']);
    drupal_set_message(t("The Flickr user associated with '%uid' will be shown to you as Flickr user '%userid'.", array(
      '%uid' => $form_state['values']['flickr_default_userid'],
      '%userid' => $info['username']['_content'],
    )));
  }
}