You are here

function certificate_snapshot_load in Certificate 7.2

Same name and namespace in other branches
  1. 8.3 certificate.module \certificate_snapshot_load()
  2. 6.2 certificate.module \certificate_snapshot_load()
  3. 6 certificate.module \certificate_snapshot_load()
  4. 7.3 certificate.module \certificate_snapshot_load()
  5. 3.x certificate.module \certificate_snapshot_load()

Quick certificates snapshot check.

Parameters

$account: The account.

$node: The node.

$cid: The certificate ID to check.

Return value

A single certificate snapshot in array format, or FALSE if none matched the incoming ID.

1 call to certificate_snapshot_load()
certificate_single in ./certificate.pages.inc
Generate a single certificate.

File

./certificate.module, line 474
Certificate module.

Code

function certificate_snapshot_load($account, $node, $cid) {

  // Pull the certificate snapshot.
  // Note that a pre-7002 snapshot, since we do not know which certificate was snapshotted, will return the existing snapshot.
  $result = db_query("SELECT * FROM {certificate_snapshots} WHERE uid = :uid AND nid = :nid AND (cid = 0 OR cid = :cid)", array(
    ':uid' => $account->uid,
    ':nid' => $node->nid,
    ':cid' => $cid,
  ));
  return $result
    ->fetch(PDO::FETCH_ASSOC);
}