According to Ayesh K, I also do not know about the basic functionality. Its workaround works, but it skips the case when a published node is instantly created.
So, I expanded the code and included it in the function:
function MYMODULE_node_is_being_published(&$node) { if (isset($node->original)) { return ( isset($node->original->status) && $node->original->status == 0 && $node->status == 1 ); } else { return $node->status == 1; } }
source share