You are here

function global_filter_user_profile_form_submit in Views Global Filter 8

Same name and namespace in other branches
  1. 7 global_filter.module \global_filter_user_profile_form_submit()

Additional handler for when the user_profile_form is submitted.

Sets the global filters as per the user profile. Includes profile2.

Gets called only if so configured on the Global Filter configuration page.

Parameters

array $form: the form

array $form_state: the form state

1 string reference to 'global_filter_user_profile_form_submit'
global_filter_form_alter in ./global_filter.module
Implements hook_form_alter().

File

./global_filter.module, line 274
global_filter.module

Code

function global_filter_user_profile_form_submit($form, &$form_state) {
  foreach (global_filter_get_parameter(NULL) as $filter) {
    if (!empty($filter['name'])) {
      $name = $filter['name'];
      $default = global_filter_user_profile_field($name);
      if (isset($default)) {
        global_filter_debug(t('Global Filter %name: setting value from user profile...', array(
          '%name' => $name,
        )));
        global_filter_set_on_session($name, $default);
      }
    }
  }
}