You are here

function node_limit_load in Node Limit 6

Same name and namespace in other branches
  1. 8 old/node_limit.module \node_limit_load()
  2. 7 node_limit.module \node_limit_load()

Loads a node limit.

Parameters

$lid: The limit id.

Return value

FALSE if the limit couldn't be loaded; otherwise the limit rule.

2 calls to node_limit_load()
_node_limit_sql in ./node_limit.module
Generates the sql statement to find the nodes that apply to a particular limit. Modules that implement hook_node_limit_sql() should sprintf their arguments into the returned array. This will be changed in Drupal 7, which will be able to accept an…
_node_limit_violates_limit in ./node_limit.module
Helper function to check limit violations for this node. Always returns FALSE for user 1.

File

./node_limit.module, line 488
Module to restrict the number of nodes a user or role may create.

Code

function node_limit_load($lid) {
  if (!is_numeric($lid)) {
    return FALSE;
  }
  $info = db_fetch_array(db_query("SELECT * FROM {node_limit} WHERE `lid`='%d'", $lid));
  if ($info['lid'] == $lid && intval($lid) >= 0) {

    //load up the information from the other modules

    //perhaps this isn't necessary.  does node_limit ever use the other modules info?

    //yes (for setting the default state of the "applies" checkbox when editing a limit)
    $res = module_invoke_all('node_limit_load', $lid);
    return array_merge($info, $res);
  }
  else {
    return FALSE;
  }
}