Yes, adding hooks is easy. To create a hook, you wrap your subroutine with GT::Plugins->dispatch. So if you have a subroutine add_review() that takes form input, adds a review, and prints out the success page, you could wrap it like:
Code:
main();
sub main {
GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'add_review', \&add_review, {});
}
sub add_review {
# Your code here
}
The arguments to dispatch are:
1. The path to the Plugins directory. This will always be $CFG->{admin_root_path} . '/Plugins'.
2. The hook name. You should make sure this is unique to avoid conflicts with other parts of the code. Try and prefix it with the name of your plugin to avoid confusion.
3. The subroutine to run. You pass in a code reference here, so typically it will just be \&yoursubroutine.
4. Any arguments that your subroutine takes. These argument will be passed into the pre hooks and can be modified, and will then be passed into your code.
Let me know if that makes sense.
Cheers,
Alex
--
Gossamer Threads Inc.