My onAfterPublish function gets called when I publish a page, but my onAfterUnpublish function does not get called when I unpublish. Is there anything extra (outside of just defining the function as I did with onAfterPublish) that I need to do to make sure onAfterUnpublish gets called when I unpublish?
Both should behave in the same fashion. The onAfterPublish event is triggered in the doUnpublish function inside SiteTree.php. I suggest you debug through SiteTree.php and see if that code is actually being called.
Putting user_error("breakpoint", E_USER_ERROR) right below $this->extend('onAfterUnpublish') in the doUnpublish() function of SiteTree.php does produce an error, so I know it's gets to the point in doUnpublish where onAfterUnpublish gets triggered.
For clarity's sake, putting the same statement at the top of my onAfterUnpublish function produces no error because onAfterUnpublish isn't getting called by doUnpublish.
Neither onBeforeUnpublish or onAfterUnpublish work for me FWIW.