You are here

function publishcontent_toggle_status in Publish Content 5

Same name and namespace in other branches
  1. 5.2 publishcontent.module \publishcontent_toggle_status()
  2. 6 publishcontent.module \publishcontent_toggle_status()
  3. 7 publishcontent.module \publishcontent_toggle_status()

Parameters

$node a node object:

1 string reference to 'publishcontent_toggle_status'
publishcontent_menu in ./publishcontent.module
Implementation of hook_menu().

File

./publishcontent.module, line 67
Add button to publish or unpublish a node, with access control based on the node type

Code

function publishcontent_toggle_status($node) {
  $node->status = !$node->status;
  node_save($node);
  drupal_set_message(_publishcontent_get_message($node->nid, $node->title, $node->status));
  drupal_goto('node/' . $node->nid);
}