node_publish_action is not publishing the node I'm trying to add a submit handler to a "Done" button that should publish a node when the button is pressed. It's a scenario where the Rules module won't cut it, it has to be in code. I tried to following:

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id){
  if($form['#form_id'] == 'my_node_form'){
    if ($form['actions']['done'] !== NULL){
      $user = user_load($form['uid']['#value']);
      $form['actions']['done']['#submit'][] = 'mymodule_publish_submit';
    }
  }
}

function mymodule_publish_submit($form, &amp;$form_state) {
    $nid = $form['nid']['#value'];
    $node = node_load($nid, $vid = NULL, $reset = FALSE);
    node_publish_action($node, $context = array());
}


but it's not working. My debug text shows up so I know the submit handler is getting called. Where am I going wrong?
Contrary to this comment on the API documentation, node_save() is required after node_publish_action() is called.

So the submit handler should look like this:

function mymodule_publish_submit($form, &amp;$form_state) {
  $nid = $form['nid']['#value'];
  $node = node_load($nid, $vid = NULL, $reset = FALSE);
  node_publish_action($node, $context = array());
  node_save($node);
}


As pointed out by jimajamma, the previous code contains a hook_action() which allows integration with Actions. The following code does the same thing, but doesn't use the hook_action()

function mymodule_publish_submit($form, &amp;$form_state) {
  $nid = $form['nid']['#value'];
  $node = node_load($nid, $vid = NULL, $reset = FALSE);
  $node-&gt;status = 1; // 0 = unpublished, 1 = published. There are no other states
  node_save($node);
}


Pretty simple.