You are here

function facebook_album_admin_form_submit in Facebook Album 7.2

Same name and namespace in other branches
  1. 7.3 facebook_album.admin.inc \facebook_album_admin_form_submit()
  2. 7 facebook_album.admin.inc \facebook_album_admin_form_submit()

Implements hook_admin()

Attempts to fetch an application access token from facebook based off of the app ID and app secret specified in the form

1 string reference to 'facebook_album_admin_form_submit'
facebook_album_admin_form in ./facebook_album.admin.inc
Implements hook_admin().

File

./facebook_album.admin.inc, line 144
facebook_album.admin.inc Facebook Album administration pages.

Code

function facebook_album_admin_form_submit($form, &$form_state) {
  $form_state['values']['facebook_album_albums'] = explode("\r\n", $form_state['values']['facebook_album_albums']);
  variable_set('facebook_album_access_token', null);
  $app_id = $form_state['values']['facebook_album_appID'];
  $app_secret = $form_state['values']['facebook_album_appSecret'];
  if (empty($app_secret) || strlen(trim($app_secret)) < 1) {
    $app_secret = variable_get('facebook_album_appSecret');
    unset($form_state['values']['facebook_album_appSecret']);
  }
  $token = _facebook_album_fetch_application_access_token($app_id, $app_secret);
  if (isset($token['error'])) {
    $message = _facebook_album_translate_api_error($token['error']['code'], $token['error']['message']);
    drupal_set_message($message, 'error');
  }
  else {
    variable_set('facebook_album_access_token', $token['access_token']);
  }
}