Prev |  | Next

### 3.13.2. admin_editforum_form_save_after_defaults

This hook is called whenever a forum is created/saved and passes the basic checks (i.e. no error is generated there). The raw `$_POST` request can be accessed and a new custom error can be generated. At this stage, the `$_POST` is still accessible in it's (almost) original form.

Call time:

Forum created or saved, passing basic phorum verification steps.

Hook input:

The $error variable (a single string message). The first hook being called always has an empty error (as the whole hook chain is only invoked in such a case), but each hook may generate an error which is passed on to other hooks in the chain. It is strongly advised that, once your hook gets called and it detects the input string containing an error (i.e. is non-zero string length), simply bail out and return the error instead of doing work and possible generating a new error. Only one error at a time can be passed to the end user through the whole chain.

Hook output:

Same as input. However, a non-zero length string signals to abort and not save any data!

Example code:

    function phorum_mod_foo_admin_editforum_form_save_after_defaults ($error)
    {
        # Early bail out in case another hook generated already an error
        if (strlen($error) > 0) {
            return $error;
        }
        # Do your stuff, possible setting $error to a error string
        # for the user to be shown; or simply leave it untouched.
        return $error;

    }

Prev | Up | Next
| Home |