You are here

function protected_node_isset_protected in Protected Node 7

Same name and namespace in other branches
  1. 5 protected_node.module \protected_node_isset_protected()
  2. 6 protected_node.module \protected_node_isset_protected()
  3. 1.0.x protected_node.module \protected_node_isset_protected()

This method determines the protected flag status for the given node id.

Note that doesn't mean the node is protected for the current user (i.e. the current user may have entered the password successfully.)

@param[in] int $nid The node id to check.

Return value

bool TRUE if the node identified by the nid you provided is protected, FALSE otherwise.

1 call to protected_node_isset_protected()
protected_node_boost_is_cacheable in ./protected_node.module
Implements hook_boost_is_cacheable().

File

./protected_node.module, line 1334
Protected Node module.

Code

function protected_node_isset_protected($nid) {
  if (!is_numeric($nid)) {
    return FALSE;
  }
  $result = db_select('protected_nodes')
    ->fields('protected_nodes', array(
    'protected_node_is_protected',
  ))
    ->condition('nid', $nid)
    ->execute()
    ->fetchField() == 1;
  return $result;
}