summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Phillips2009-10-19 18:03:59 (GMT)
committer Chad Phillips2009-10-19 18:03:59 (GMT)
commit5618d27da229b123ff04d1fd59f5465566223fc1 (patch)
treefb3a987250515eb35b0e6b442155cb8c02e78cb8
parent9ea57d7d7c4ef7ccd179c884c67f2a1cfbfa95b4 (diff)
much cleaner implementation of the site 403 variable reset logic.
-rw-r--r--logintoboggan.install16
-rwxr-xr-xlogintoboggan.module26
2 files changed, 15 insertions, 27 deletions
diff --git a/logintoboggan.install b/logintoboggan.install
index c844b24..ae6cc75 100644
--- a/logintoboggan.install
+++ b/logintoboggan.install
@@ -1,12 +1,26 @@
<?php
// $Id$
+/**
+ * Implement hook_update_last_removed().
+ */
function logintoboggan_update_last_removed() {
return 6001;
}
/**
- * Implementation of hook_uninstall().
+ * Implement hook_disable().
+ *
+ */
+function logintoboggan_disable() {
+ // Clean up the custom access denied path if it's set.
+ if (variable_get('site_403', '') == 'toboggan/denied') {
+ variable_set('site_403', '');
+ }
+}
+
+/**
+ * Implement hook_uninstall().
*/
function logintoboggan_uninstall() {
$variables = array(
diff --git a/logintoboggan.module b/logintoboggan.module
index 26d30c7..cd2ef3a 100755
--- a/logintoboggan.module
+++ b/logintoboggan.module
@@ -146,17 +146,6 @@ function logintoboggan_form_block_admin_configure_alter(&$form, &$form_state) {
}
/**
- * Implement hook_form_system_modules_alter().
- *
- * @ingroup logintoboggan_core
- */
-function logintoboggan_form_system_modules_alter(&$form, &$form_state) {
- // This will reset the the site 403 variable to the default if the module is
- // disabled and the toboggan redirect on access denied is enabled.
- $form['#validate'][] = 'logintoboggan_site_403_validate';
-}
-
-/**
* Implement hook_form_logintoboggan_main_settings_alter().
*
* @ingroup logintoboggan_core
@@ -1298,21 +1287,6 @@ function _logintoboggan_process_redirect($redirect, $account) {
}
/**
- * Resets the the site 403 variable to the default if the module is disabled
- * and the toboggan redirect on access denied is enabled.
- */
-function logintoboggan_site_403_validate($form, &$form_state) {
- // The check order is important:
- // 1. Is the module disabled? Skip if so.
- // 2. Has the module been selected to be disabled?
- // 3. Is the current site 403 toboggan/denied?
- // Only reset the site 403 variable if 2 and 3 are true.
- if (!isset($form_state['values']['disabled_modules']['logintoboggan']) && !$form_state['values']['status']['logintoboggan'] && (variable_get('site_403', '') == 'toboggan/denied')) {
- variable_set('site_403', '');
- }
-}
-
-/**
* Takes custom settings on the main settings page, transforms them into the
* appropriate core setting, and cleans up the custom values.
*/