You are here

function fb_permissions_facebook_permissions_settings_submit in Facebook Autopost 7

Submit callback to save permissions to a variable.

File

fb_permissions/fb_permissions.module, line 126
Module implementation file.

Code

function fb_permissions_facebook_permissions_settings_submit($form, &$form_state) {
  $values = array_filter($form_state['values']);
  $role_id = $values['role'];
  unset($values['facebook_permissions__active_tab']);
  unset($values['submit']);
  unset($values['version']);
  unset($values['form_build_id']);
  unset($values['form_token']);
  unset($values['form_id']);
  unset($values['op']);
  unset($values['role']);
  $values = array_map('replace_vertical_bar_dot', array_keys($values));
  variable_set('fb_permissions_facebook_permissions:' . $role_id, $values);
  $roles = user_roles();
  drupal_set_message(t('Facebook permissions have been set for role: %role_name.', array(
    '%role_name' => $roles[$role_id],
  )));
}