function _node_limit_violates_limit in Node Limit 8
Same name and namespace in other branches
- 6 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
object $node: The node to check.
3 calls to _node_limit_violates_limit()
- node_limit_access in old/
node_limit.module - Custom access callback for node/add/TYPE pages.
- node_limit_node_prepare in old/
node_limit.module - Implements hook_node_prepare().
- node_limit_node_validate in old/
node_limit.module - Implements hook_node_validate().
File
- old/
node_limit.module, line 231
Code
function _node_limit_violates_limit(&$node) {
if ($node->uid == 1 || user_access(NODE_LIMIT_PERM_OVERRIDE)) {
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;
}
$select = _node_limit_sql($limit['lid']);
$count = $select
->execute()
->fetchField();
if ($count >= $limit['nlimit']) {
return TRUE;
}
}
return FALSE;
}