function _node_limit_violates_limit in Node Limit 6
Same name and namespace in other branches
- 8 old/node_limit.module \_node_limit_violates_limit()
- 7 node_limit.module \_node_limit_violates_limit()
Helper function to check limit violations for this node. Always returns FALSE for user 1.
Parameters
$node: The node to check.
1 call to _node_limit_violates_limit()
- node_limit_nodeapi in ./node_limit.module 
- Implementation of hook_nodeapi().
File
- ./node_limit.module, line 113 
- Module to restrict the number of nodes a user or role may create.
Code
function _node_limit_violates_limit($node) {
  if ($node->uid == 1) {
    return FALSE;
  }
  $limits = node_limit_limits($node);
  foreach ($limits as $idx => $lid) {
    $limit = node_limit_load($lid);
    if ($limit['nlimit'] == NODE_LIMIT_NO_LIMIT) {
      continue;
    }
    $sql = _node_limit_sql($limit['lid']);
    $count = db_result(db_query($sql));
    if ($count >= $limit['nlimit']) {
      return TRUE;
    }
  }
  return FALSE;
}