You are here

function popup_maker_disable_popup in Popup Maker - All popup types 7

1 call to popup_maker_disable_popup()
popup_maker_update_status in ./popup_maker.admin.inc

File

./popup_maker.admin.inc, line 89

Code

function popup_maker_disable_popup() {
  if (!isset($_POST['id'])) {
    drupal_set_message('Parameter "id" is required to disable a popup', 'error');
    return false;
  }
  $id = abs(intval($_POST['id']));
  if ($id != $_POST['id']) {
    drupal_set_message('Parameter "id" must be non negative integer', 'error');
    return false;
  }
  $config = variable_get('popup_maker_settings', array(
    'api_key' => null,
    'popups' => array(),
    'popupSettings' => array(),
    'user' => array(),
  ));
  if (empty($config['popupSettings'])) {
    $config['popupSettings'] = array();
  }
  if (!isset($config['popupSettings'][$_POST['id']])) {
    $config['popupSettings'][$_POST['id']] = array();
  }
  $config['popupSettings'][$_POST['id']]['enabled'] = 0;
  variable_set('popup_maker_settings', $config);
  drupal_set_message('Popup Disabled successfully');
}