You are here

function regcode_roles_install in Registration codes 7

Same name and namespace in other branches
  1. 6.2 regcode_roles/regcode_roles.install \regcode_roles_install()
  2. 6 regcode_roles/regcode_roles.install \regcode_roles_install()
  3. 7.2 regcode_roles/regcode_roles.install \regcode_roles_install()

Implements hook_install().

When using this module with role_expire and regcode_voucher, the regcode_voucher module must run after the role_expire module. Otherwise, role_expire wipes any new expiriations that regcode_roles tries to create.

File

regcode_roles/regcode_roles.install, line 15
Install, update and uninstall functions for the regcode_roles module.

Code

function regcode_roles_install() {
  if (module_exists('role_expire') && module_exists('regcode_voucher')) {
    $weight = db_select('system', 's')
      ->fields('s', array(
      'weight',
    ))
      ->condition('name', 'role_expire', '=')
      ->execute()
      ->fetchField();
    db_update('system')
      ->fields(array(
      'weight' => $weight + 1,
    ))
      ->condition('name', 'regcode_voucher', '=')
      ->execute();
  }
}