function socialfeed_settings_form_submit in Social Feed 6
Implements form_submit().
File
- ./
socialfeed.module, line 295 - Module for fetching data from Facebook, Twitter, Youtube, and Foursquare. This module provides block content retrieved from a
Code
function socialfeed_settings_form_submit(&$form, &$form_state) {
$socialfeed_vars = array(
'socialfeed_facebook_profile_id' => $form_state['values']['socialfeed_facebook_profile_id'],
'socialfeed_facebook_app_id' => $form_state['values']['socialfeed_facebook_app_id'],
'socialfeed_facebook_app_secret' => $form_state['values']['socialfeed_facebook_app_secret'],
'socialfeed_twitter_profile_id' => $form_state['values']['socialfeed_twitter_profile_id'],
'socialfeed_youtube_profile_name' => $form_state['values']['socialfeed_youtube_profile_name'],
'socialfeed_foursquare_access_token' => $form_state['values']['socialfeed_foursquare_access_token'],
'socialfeed_title' => $form_state['values']['socialfeed_title'],
'socialfeed_displaycount' => $form_state['values']['socialfeed_displaycount'],
'socialfeed_facebook_title_checkbox' => $form_state['values']['socialfeed_facebook_title_checkbox'],
'socialfeed_facebook_title' => $form_state['values']['socialfeed_facebook_title'],
'socialfeed_twitter_title_checkbox' => $form_state['values']['socialfeed_twitter_title_checkbox'],
'socialfeed_twitter_title' => $form_state['values']['socialfeed_twitter_title'],
'socialfeed_youtube_title_checkbox' => $form_state['values']['socialfeed_youtube_title_checkbox'],
'socialfeed_youtube_title' => $form_state['values']['socialfeed_youtube_title'],
'socialfeed_foursquare_title_checkbox' => $form_state['values']['socialfeed_foursquare_title_checkbox'],
'socialfeed_foursquare_title' => $form_state['values']['socialfeed_foursquare_title'],
);
foreach ($socialfeed_vars as $key => $value) {
variable_set($key, $value);
}
// Flush the table when these feeds are changed to keep data clean.
socialfeed_flush();
// Retrieve data.
if ($form_state['values']['socialfeed_facebook_profile_id'] && $form_state['values']['socialfeed_facebook_app_id'] && $form_state['values']['socialfeed_facebook_app_secret']) {
socialfeed_facebook();
drupal_set_message(t("Facebook data has been updated as needed."));
}
if ($form_state['values']['socialfeed_twitter_profile_id']) {
socialfeed_twitter();
drupal_set_message(t("Twitter data has been updated as needed."));
}
if ($form_state['values']['socialfeed_youtube_profile_name']) {
socialfeed_youtube();
drupal_set_message(t("Youtube data has been updated as needed."));
}
if ($form_state['values']['socialfeed_foursquare_access_token']) {
socialfeed_foursquare();
drupal_set_message(t("Foursquare data has been updated as needed."));
}
drupal_set_message(t("Your feed settings have been saved. Data has been change accordingly."));
}