You are here

function user_limit_reached in User Limit 7

Same name and namespace in other branches
  1. 6 user_limit.module \user_limit_reached()

Calculates whether the number of allowed users on the site has been reached.

This limit is based on the settings. The number is calculated with user_limit_count_users(), which makes the result vary according to settings.

Parameters

$insert: Set to TRUE if this is being called from a user_insert function.

Return value

TRUE if the limit is reached, FALSE otherwise.

2 calls to user_limit_reached()
user_limit_form_user_register_form_alter in ./user_limit.module
Implements hook_FORM_ID_alter().
user_limit_user_insert in ./user_limit.module
Implements hook_user_insert().

File

./user_limit.module, line 160
The User Limit module limits the number of users that can be registered on a Drupal site.

Code

function user_limit_reached($insert = FALSE) {
  $user_limit = variable_get('user_limit', 0);
  $new_user_limit = $insert ? $user_limit + 1 : $user_limit;
  if ($user_limit && user_limit_count_users() >= $new_user_limit) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}