You are here

function anonymous_publishing_activate in Anonymous Publishing 5

Page callback; activate a node published anonymously. This is the page callback of the links sent to the user by email to activate the node.

Parameters

$node: The node object.

$akey: The activation key.

1 string reference to 'anonymous_publishing_activate'
anonymous_publishing_menu in ./anonymous_publishing.module
Implementation of hook_menu().

File

./anonymous_publishing.module, line 154
Installation file for the anonymous_publishing module.

Code

function anonymous_publishing_activate($node, $akey) {
  db_query("UPDATE {node} SET status = 1 WHERE nid = %d", $node->nid);
  db_query("UPDATE {anonymous_publishing} SET activated = 1 WHERE nid = %d", $node->nid);
  node_load($node->nid, NULL, TRUE);
  drupal_set_message(t('Congratulations, your post has been activated.'));
  if (node_access('view', $node)) {
    drupal_goto('node/' . $node->nid, '/view');
  }
  else {
    drupal_goto();
  }
}