Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal 7 How to trigger/hook the node "Publish" event?

In Drupal 7, I want to add a additional process when a node gets Published. How can I get triggered when that node's "Publish" event fires?

Is there any hook for node "Publish"?

like image 913
夏期劇場 Avatar asked Dec 21 '22 15:12

夏期劇場


1 Answers

With core functionality, there is no hook. But Revisioning module provides one.

You can however workaround by checking node's status on update OP. Not very smart though.

<?php
function MYMODULE_node_update($node){
  if (isset($node->original->status) && $node->original->status == 0 && $node->status == 1){
     MYMODULE_mymagic_func($node);
  }
}
like image 86
AKS Avatar answered Dec 31 '22 13:12

AKS