1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- /**
- * @file
- * Install, update and uninstall functions for the Forgotten Login module.
- */
- /**
- * Implements hook_install().
- */
- function forgotten_login_install() {
- $spec = array(
- 'type' => 'int',
- 'size' => 'normal',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'initial' => 0,
- );
- db_add_field('users', 'forgotten_login_attempts', $spec);
- $t = get_t();
- $t_args = array('@settings_page_url' => url('admin/config/people/forgotten_login'));
- drupal_set_message($t('Forgotten login module has been installed. You will need to visit the <a href="@settings_page_url">settings page</a> to set a login attempts limit before this module will do anything.', $t_args));
- }
- /**
- * Implements hook_uninstall().
- */
- function forgotten_login_uninstall() {
- db_drop_field('users', 'forgotten_login_attempts');
- }
- /**
- * Implements hook_schema_alter().
- */
- function forgotten_login_schema_alter(&$schema) {
- // Add field to existing schema.
- $schema['users']['fields']['forgotten_login_attempts'] = array(
- 'type' => 'int',
- 'size' => 'normal',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'How many failed login attempts the user has made.',
- );
- }
|