You are here

inactive_user.install in Inactive User 6

Same filename and directory in other branches
  1. 5 inactive_user.install
  2. 7 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.
 */

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

/**
 * Implementation of hook_uninstall().
 */
function inactive_user_uninstall() {
  drupal_uninstall_schema('inactive_user');

  //SELECT name FROM variable WHERE (name LIKE 'inactive_user_%');
  $inactive_user_variables = "inactive_user_%";
  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE '%s'", $inactive_user_variables);
  while ($row = db_fetch_object($settings)) {
    variable_del($row->name);
  }
  drupal_set_message(t("Inactive user has been uninstalled."));
}

Functions