You are here

hide_submit.install in Hide submit button 6

Same filename and directory in other branches
  1. 5 hide_submit.install
  2. 7.2 hide_submit.install
  3. 7 hide_submit.install

Hide the submit button after clicked to prevent/reduce duplicate postings.

Installation and update procedures are defined in this file

File

hide_submit.install
View source
<?php

// $Id$

/**
 * @file
 * Hide the submit button after clicked to prevent/reduce duplicate postings.
 * 
 * Installation and update procedures are defined in this file
 */

/**
* Implement hook install
*/
function hide_submit_install() {

  // This change allow most modules to have their init() hook
  // implementation called before hide_submit's one. This take
  // sense for modules that play with theme, like themekey or
  // section, so they can initialize the current theme before
  // hide_submit.
  update_sql("UPDATE {system} SET weight = 10 WHERE type = 'module' AND name = 'hide_submit'");
  drupal_set_message(st('Hide submit module installed.'));
}

/**
* Implement hook uninstall
*/
function hide_submit_uninstall() {

  // Delete any variables that have been set.
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'hide_submit_%'");
  while ($row = db_fetch_object($result)) {
    variable_del($row->name);
  }
  drupal_set_message(st('Hide submit module variables deleted.<br />To completely remove this module, delete the hide_submit directory from your files directory.'));
}

/**
* Implement hook update_N
*/
function hide_submit_update_6100() {
  if (!variable_get('hide_submit_toggle_image', TRUE)) {
    variable_set('hide_submit_toggle_custom_image', TRUE);
    variable_set('hide_submit_image', variable_get('hide_submit_image_link', HIDE_SUBMIT_DEFAULT_IMAGE));
  }
  return array();
}
function hide_submit_update_6101() {
  $load_option = variable_get('hide_submit_js_load_option', HIDE_SUBMIT_DEFAULT_JS_LOAD);
  switch ($load_option) {

    // Option #1 load on every page was omitted
    // Option #3 load on every page and exclude listed renumbered as #1
    case 3:
      variable_set('hide_submit_js_load_option', HIDE_SUBMIT_EXCLUDE_LISTED_PAGES);
      break;
    case 1:
      if (variable_get('hide_submit_js_load_pages', '') != "") {
        drupal_set_message(st('Hide Submit Warning: Please note that the option to load script on every page was omitted. To load on every page make sure to clear the list of excluded pages. visit the settings page to review your settings'), 'warning');
      }
      break;
    default:
      break;
  }
  return array();
}
function hide_submit_update_6102() {
  $ret = array();
  $ret[] = update_sql("UPDATE {system} SET weight = 10 WHERE type = 'module' AND name = 'hide_submit'");
  return $ret;
}

Functions

Namesort descending Description
hide_submit_install Implement hook install
hide_submit_uninstall Implement hook uninstall
hide_submit_update_6100 Implement hook update_N
hide_submit_update_6101
hide_submit_update_6102