}
// canAdd determines if we can add a user in case there is a limit.
- static function canAdd() {
+ static function canAdd($num_users = 1) {
$mdb2 = getConnection();
$sql = "select param_value from tt_site_config where param_name = 'max_users'";
$res = $mdb2->query($sql);
if (!$val) return true; // No limit.
$max_count = $val['param_value'];
- $sql = "select count(*) as user_count from tt_users where status is not null";
+ $sql = "select count(*) as user_count from tt_users where group_id > 0 and status is not null";
$res = $mdb2->query($sql);
$val = $res->fetchRow();
- if ($val['user_count'] < $max_count)
+ if ($val['user_count'] <= $max_count - $num_users)
return true; // Limit not reached.
return false;