You are here

apply_for_role.install in Apply for role 5

Allows users to apply for roles.

File

apply_for_role.install
View source
<?php

/**
 * @file
 * Allows users to apply for roles.
 */

/**
 * Implementation of hook_install().
 */
function apply_for_role_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {users_roles_apply} (\n        uid int unsigned NOT NULL default '0',\n        rid int unsigned NOT NULL default '0',\n        approved int(1) unsigned NOT NULL default '0',\n        apply_date int(11) unsigned NOT NULL default '0',\n        approve_date int(11) unsigned NOT NULL default '0',\n        PRIMARY KEY (uid, rid)\n      )");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {users_roles_apply} (\n        uid int unsigned NOT NULL default '0',\n        rid int unsigned NOT NULL default '0',\n        approved int(1) unsigned NOT NULL default '0',\n        apply_date int(11) unsigned NOT NULL default '0',\n        approve_date int(11) unsigned NOT NULL default '0',\n        PRIMARY KEY (uid, rid)\n      )");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function apply_for_role_uninstall() {
  db_query('DROP TABLE {users_roles_apply}');
  variable_del('users_apply_roles');
  variable_del('apply_for_role_multiple');
  variable_del('apply_for_role_register');
}

Functions

Namesort descending Description
apply_for_role_install Implementation of hook_install().
apply_for_role_uninstall Implementation of hook_uninstall().