You are here

function user_limit_form_user_register_alter in User Limit 6

Implementation of hook_FORM_ID_alter().

Adds a message to the user_register form based as relevant.

File

./user_limit.module, line 99
Everything related to User Limit. There are no include files.

Code

function user_limit_form_user_register_alter(&$form, &$form_state) {
  $user_limit = variable_get('user_limit', 0);
  if ($user_limit != 0) {
    $number_allowed = variable_get('user_limit', 0) > 0 ? variable_get('user_limit', 0) : '&infin';
    $t_array = array(
      '!number_allowed' => $number_allowed,
      '!number_active' => user_limit_count_users(),
    );
    drupal_set_message(t('User limit (active/allowed): !number_active / !number_allowed ', $t_array), 'status', FALSE);
    if (user_limit_reached() || user_limit_surpassed()) {
      drupal_set_message(variable_get('user_limit_message', USER_LIMIT_DEFAULT_MESSAGE), 'warning', FALSE);
    }
  }
}