How can I detect when a node is changed from 'Published' to 'Unpublished'?
Nevermind. After reading through the issue linked above (especially comment #38), I found that the $node object (any entity, actually) stores the 'original' cached copy in $entity->original.

So, I wanted to detect whether a node changed from 'status = 1' to 'status = 0' (this happens when the node is unpublished), and the following code does this:

&lt;?php
function custom_node_update($node) {
  if ($node-&gt;type == 'article') {
    // Act on the unpublishing of an article.
    if ($node-&gt;original-&gt;status == 1 &amp;&amp; $node-&gt;status == 0) {
      // Do something here.
    }
    // Act on the publishing of an article.
    if ($node-&gt;original-&gt;status == 0 &amp;&amp; $node-&gt;status == 1) {
      // Do something here.
    }
  }
}
?&gt;