You are here

function _device_geolocation_check_frequency_validate in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 modules/device_geolocation/device_geolocation.module \_device_geolocation_check_frequency_validate()

Validation handler to update the "Geolocate on specific pages".

1 string reference to '_device_geolocation_check_frequency_validate'
device_geolocation_form_alter in modules/device_geolocation/device_geolocation.module
Implements hook_form_alter()

File

modules/device_geolocation/device_geolocation.module, line 202
Provides visitor's geographical location using client device location source that implements W3C Geolocation API and Google Geocoding service.

Code

function _device_geolocation_check_frequency_validate($form, &$form_state) {
  $value = $form_state['values']['device_geolocation_check_frequency'];
  if ($value == '') {
    $form_state['values']['device_geolocation_check_frequency'] = NULL;
  }
  elseif (!is_numeric($value) || $value < 0) {
    form_set_error('device_geolocation_check_frequency', t("Frequency of user's geolocation checking must be a positive number."));
  }
  else {

    // Convert from hours to seconds
    $form_state['values']['device_geolocation_check_frequency'] = $value * 3600;
  }
}