You are here

function user_badges_settings_form_submit in User Badges 7

Same name and namespace in other branches
  1. 5 user_badges.module \user_badges_settings_form_submit()
  2. 6.2 user_badges.admin.inc \user_badges_settings_form_submit()
  3. 6 user_badges.admin.inc \user_badges_settings_form_submit()
  4. 7.2 user_badges.admin.inc \user_badges_settings_form_submit()
  5. 7.3 user_badges.admin.inc \user_badges_settings_form_submit()

Submission function for user_badges_settings_form.

Set the variables and display a message about the set values.

File

./user_badges.admin.inc, line 840
@brief User Badges admin functions

Code

function user_badges_settings_form_submit($form, $form_state) {
  variable_set('user_badges_showone', $form_state['values']['showone']);
  variable_set('user_badges_showblocked', $form_state['values']['showblocked']);
  variable_set('user_badges_userweight', $form_state['values']['userweight']);
  variable_set('user_badges_list_show_users', $form_state['values']['show_users']);
  variable_set('user_badges_imagecache', $form_state['values']['imagecache']);
  variable_set('user_badges_nobadges', $form_state['values']['nobadges']);

  // Only set a default href if we have some non-whitespace in there.
  $defaulthref = trim($form_state['values']['defaulthref']);
  if (empty($defaulthref)) {
    variable_del('user_badges_defaulthref');
  }
  else {
    variable_set('user_badges_defaulthref', $form_state['values']['defaulthref']);
  }

  // Only set a vid if we have a value, otherwise wipe it for none/no taxonomy.
  if ($form_state['values']['vid']) {
    variable_set('user_badges_vid', $form_state['values']['vid']);
  }
  else {
    variable_del('user_badges_vid');
  }
  drupal_set_message(t('Configuration saved.'));
}