You are here

function user_external_invite_system_info_alter in User External Invite 1.0.x

Same name and namespace in other branches
  1. 7.2 user_external_invite.module \user_external_invite_system_info_alter()
  2. 7 user_external_invite.module \user_external_invite_system_info_alter()

Implements hook_system_info_alter().

Prevent disabling of module if pending invites are present.

File

./user_external_invite.module, line 917
Invites a user to site when connecting via external protocol e.g. LDAP.

Code

function user_external_invite_system_info_alter(&$info, $file, $type) {
  if ($type == 'module' && $file->name == 'user_external_invite') {
    if (db_field_exists('user_external_invite', 'status') && db_query('SELECT * FROM {user_external_invite} WHERE status = :status', array(
      ':status' => 'Pending',
    ))
      ->fetchAll()) {
      $info['required'] = TRUE;
      $explanation = t('This module can\'t be disabled when there are invites pending. See a list of pending invites here - <a href="@invites">Invites list</a>', array(
        '@invites' => url('admin/people/invite/operations'),
      ));
      $info['explanation'] = $explanation;
    }
  }
}