Issue a Conditional Redirect in Drupal 7 I have a custom payment form that redirects to a 'Thank You' page on success. The page is just a Page type node, so someone can control the content of the page.

What I wanted to do was add a little extra, and prevent the page from being seen unless they had just come from the form.

I tried using 3 functions. hook_node_view, hook_node_view_alter, and hook_init.

I thought the first two would allow me to check the node path or nid, and redirect if I needed to, but they did not seem to be called. Additionally, I tried 

mymodule_init() {
  global $user;
  krumo($user);exit;
}


That was not being hit, either. The rest of the module works fine, custom menu item, custom form, validate/submit/mail hooks. I am stumped.

How can I check a node value when loading, take action, and furthermore, why is hook_init() not dumping/exiting?
You should not use hook_init, but hook_boot as you want to perform the check when caching is turned on. That would also be the best explanation as to why your exit doesn't work. That or you forgot to clear cache after implementing the hook. (All hooks are cached in D7)