You are here

function flag_comment::type_access_multiple in Flag 7.2

Same name and namespace in other branches
  1. 6.2 flag.inc \flag_comment::type_access_multiple()
  2. 7.3 includes/flag/flag_comment.inc \flag_comment::type_access_multiple()

File

./flag.inc, line 1687
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_comment
Implements a comment flag.

Code

function type_access_multiple($content_ids, $account) {
  $access = array();

  // Ensure node types are granted access. This avoids a
  // node_load() on every type, usually done by applies_to_content_id().
  $query = db_select('comment', 'c');
  $query
    ->innerJoin('node', 'n', 'c.nid = n.nid');
  $result = $query
    ->fields('c', array(
    'cid',
  ))
    ->condition('c.cid', $content_ids, 'IN')
    ->condition('n.type', $this->types, 'NOT IN')
    ->execute();
  foreach ($result as $row) {
    $access[$row->nid] = FALSE;
  }
  return $access;
}