You are here

inactive_user.install in Inactive User 7

Same filename and directory in other branches
  1. 5 inactive_user.install
  2. 6 inactive_user.install

The inactive user module controls inactive users.

The inactive user module sends mails to inactive users. The user can configure the time after Drupal sends mails.

File

inactive_user.install
View source
<?php

/**
 * @file
 * The inactive user module controls inactive users.
 *
 * The inactive user module sends mails to inactive users.
 * The user can configure the time after Drupal sends mails.
 */

/**
 * Implements hook_schema().
 */
function inactive_user_schema() {
  $schema['inactive_users'] = array(
    'description' => 'The base table for inactive_users.',
    'fields' => array(
      'uid' => array(
        'description' => 'The primary identifier for a user.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'notified_admin' => array(
        'description' => 'Admin notifier.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'notified_user' => array(
        'description' => 'User notifier.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'warned_user_block_timestamp' => array(
        'description' => 'Timestamp warning.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'notified_user_block' => array(
        'description' => 'User block warning.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'notified_admin_block' => array(
        'description' => 'Timestamp warning.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'warned_user_delete_timestamp' => array(
        'description' => 'Timestamp warning.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'protected' => array(
        'description' => 'Timestamp warning.',
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'uid',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function inactive_user_uninstall() {
  variable_del('inactive_user_preserve_content');
  variable_del('inactive_user_timestamp');
  $query = db_select('variable', 'v')
    ->fields('v', array(
    'name',
  ))
    ->condition('name', 'inactive_user_%', 'LIKE')
    ->execute()
    ->fetchAll();
  foreach ($query as $row) {
    variable_del($row->name);
  }
  drupal_set_message(t('Inactive user has been uninstalled.'));
}

Functions