logintoboggan.install in LoginToboggan 7
Same filename and directory in other branches
Install, update and uninstall functions for the logintoboggan module.
File
logintoboggan.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the logintoboggan module.
*/
/**
* Implement hook_update_last_removed().
*/
function logintoboggan_update_last_removed() {
return 6001;
}
/**
* 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', '');
}
}
/**
* Remove hard-coded numeric deltas from blocks.
*/
function logintoboggan_update_7000(&$sandbox) {
// Get an array of the renamed block deltas, organized by module.
$renamed_deltas = array(
'logintoboggan' => array(
'0' => 'logintoboggan_logged_in',
),
);
update_fix_d7_block_deltas($sandbox, $renamed_deltas, array());
}
/**
* Implement hook_uninstall().
*/
function logintoboggan_uninstall() {
$variables = array(
'logintoboggan_login_block_type',
'logintoboggan_login_block_message',
'logintoboggan_login_with_email',
'logintoboggan_confirm_email_at_registration',
'logintoboggan_pre_auth_role',
'logintoboggan_purge_unvalidated_user_interval',
'logintoboggan_redirect_on_register',
'logintoboggan_redirect_on_confirm',
'logintoboggan_login_successful_message',
'logintoboggan_minimum_password_length',
'logintoboggan_immediate_login_on_register',
'logintoboggan_override_destination_parameter',
'logintoboggan_denied_remove_sidebars',
'logintoboggan_anon_403',
'logintoboggan_auth_403',
);
foreach ($variables as $variable) {
variable_del($variable);
}
}
/**
* Implement hook_requirements
*/
function logintoboggan_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'runtime') {
$non_auth = variable_get('logintoboggan_pre_auth_role');
//Check whether there is a non-authenticated role set and that it is not
//the standard authenticated user role. If so, add a status report entry.
$roles = user_roles();
if (is_numeric($non_auth) && $non_auth != DRUPAL_AUTHENTICATED_RID) {
$rolename = $roles[$non_auth];
$requirements['Logintoboggan'] = array(
'title' => $t('Logintoboggan non-authenticated user configuration'),
'description' => $t('Logintoboggan has set an active role that users can have, prior to providing email authentication. Ensure this does not conflict with modules such as OG that assume that all users have the standard authenticated role.'),
'value' => check_plain('Role name: ' . $rolename),
'severity' => REQUIREMENT_WARNING,
);
}
}
return $requirements;
}
Functions
Name![]() |
Description |
---|---|
logintoboggan_disable | Implement hook_disable(). |
logintoboggan_requirements | Implement hook_requirements |
logintoboggan_uninstall | Implement hook_uninstall(). |
logintoboggan_update_7000 | Remove hard-coded numeric deltas from blocks. |
logintoboggan_update_last_removed | Implement hook_update_last_removed(). |