How do I implement hook_finder_goto_alter()? I'm having a bit of trouble with troubleshooting a module I am working. I am trying to modify a module to redirect traffic but even though its enabled it doesn't seem to do anything.  I've had problems in the past with using hooks and i'm not sure what I'm doing wrong.

I am basically using the finder module and here's the code to redirect:

function test_finder_goto_alter(&amp;$result, $finder) {
  /* Redirect to a different page in the current directory that was requested */
    drupal_goto("testpage");
}


I see the module in modules and enabled it but it still doesn't redirect the way I want it to.  Do you have any suggestion on what I'm doing wrong? I don't think its specific to this module I think I might be doing something wrong in general.
Hooks 101

hooks should be created in a module. The module which they are called from should be enabled. 

So in the first instance you will need to create a .info and a .module file with the correct information in.

Then to implement a hook you must use the module name. 

So the example code above would work if the php code is in a module called test which was enabled. 

So hook_menu() in a module called test.module would be a function called test_menu()

Secondly hooks will only be called when invoked, some get invoked rarely when for example building the menu system, and others are invoked when specific actions happen. You will need to read up on the documentation for the hook in question to find out more.

The same goes for parameters and return values, each hook is different. So the documentation is important there.  

So a general checklist for hooks. 


Is the hook in a module?
Is the module enabled?
Is the hook named the same as the
module?
Is the action which is calling the
hook being called?
Have I cleared the cache?
Am I using the hook in the correct way?