Search »

Hooks Manager

Code Hooks

Hooks Manager - add hook
Hooks Manager - add hook

As mentioned earlier, code hooks let you add your own PHP to be executed at specific points in the code, like updating submissions or editing client accounts. Here's what each of the fields mean on the Add/Edit Hooks page:

  • Status: whether this rule is enabled or not. This provides a convenient way to turn off - but not delete - a rule.
  • Rule Name: a description of what the rule is doing.
  • Priority: a single hook can have multiple rules assigned to it; rules can be defined through the Hooks Manager or through custom modules. This setting determines in what order your code should get executed.
  • Hook Type: Code / Template / Custom. Choosing a different type shows different options in the grey box beneath it.
  • Code Hook: this is a list of all available code hooks within Form Tools. In order to pick the appropriate hook, you'll need to review the Form Tools source code to figure out where you need to attach your code, depending on your requirements. The names are mostly descriptive: in many cases you should be able to get a sense of what the hook is about from the function name. [Tip: to locate the code hooks, do a search in the /global/code folder for "extract". Those lines are the hooks].
  • PHP Code: the code for your hook. To help out a little, at the bottom of the page there is a list of what variables have been passed to this particular code hook and what can be overwritten.

    As with the function names, hopefully you will get a sense of what information is stored in each variable by the variable name. But in case you're not clear, either view the source code for more information or do a print_r() on the variable, followed by an exit(); and load whatever page is running the hook.