You are here

function subuser_get_subuser_limit in Subuser 6

API function to get the max number of subusers this user is allowed to create.

Parameters

$uid: [optional] The uid of the parent account. Defaults to the global site-wide limit.

Return value

Integer limit

2 calls to subuser_get_subuser_limit()
subuser_create_form in ./subuser.pages.inc
Create subuser form.
subuser_user in ./subuser.module
Implementation of hook_user().

File

./subuser.module, line 455
Allows users of a particular role to create sub user account in another role.

Code

function subuser_get_subuser_limit($uid = NULL) {

  // Check to see if this user has a specific limit.
  if ($uid !== NULL) {
    $limit = (int) db_result(db_query("SELECT subuser_limit FROM {subuser_limit} WHERE uid = %d", $uid));
  }

  // If we don't have a limit for this user, or we don't have a uid use the global limit.
  if ($uid == NULL || $limit == NULL) {
    $limit = (int) variable_get('subuser_limit', NULL);
  }
  return $limit;
}