You are here

function node_authlink_get_url in Node authorize link 7

Same name and namespace in other branches
  1. 8 node_authlink.module \node_authlink_get_url()

Get edit URL of specified node.

Parameters

int|object $node: Node object or NID.

string $op: Operation to do with node. view, edit (default) or delete.

Return value

string The node operation's URL with authkey query appended.

1 call to node_authlink_get_url()
node_authlink_tokens in ./node_authlink.module
Implements hook_tokens().

File

./node_authlink.module, line 178
Provides functionality for the node_authlink module.

Code

function node_authlink_get_url($node, $op = 'edit') {
  if (is_numeric($node)) {
    $node = node_load($node);
  }
  if (!isset($node->authkey)) {
    return FALSE;
  }
  if ($op == 'view') {
    $op = '';
  }
  else {
    $op = '/' . $op;
  }
  return url("node/{$node->nid}{$op}", array(
    'absolute' => TRUE,
    'query' => array(
      'authkey' => $node->authkey,
    ),
  ));
}