You are here

function certificate_node_certificate in Certificate 8.3

Same name and namespace in other branches
  1. 6.2 certificate.pages.inc \certificate_node_certificate()
  2. 6 certificate.pages.inc \certificate_node_certificate()
  3. 7.3 certificate.pages.inc \certificate_node_certificate()
  4. 7.2 certificate.pages.inc \certificate_node_certificate()
  5. 3.x certificate.pages.inc \certificate_node_certificate()

Get certificate for a specific node.

1 string reference to 'certificate_node_certificate'
certificate_menu in ./certificate.module
Implements hook_menu().

File

./certificate.pages.inc, line 11
certificate.pages.inc Functions for generating certificates.

Code

function certificate_node_certificate($node) {
  global $user;
  $admin = user_access('administer certificates');
  $view_all = user_access('view all user certificates');

  // Use account of a different user if allowed.
  if (($admin || $view_all) && arg(3) > 0) {
    $account = user_load(arg(3));
  }
  else {
    $account = $user;
  }
  $perm = certificate_can_access_certificate($node, $account);
  if ($perm != 1) {

    //$perm is a string! show error.
    return $perm;
  }
  return certificate_single($account, $node);
}