Prev |  | Next

### 3.14.2. before_edit

This hook can be used to change the edited message before it is stored in the database.

Call time:

In `include/posting/action_edit.php`, right before storing an edited message in the database.

Hook input:

An array containing message data and an optional parameter which holds the original message data (added in Phorum 5.2.15)

Hook output:

Same as input.

Example code:

    function phorum_mod_foo_before_edit($dbmessage,$orig_message)
    {
        global $PHORUM;

        // If the message body does not contain the disclaimer, add it
        if (strpos($dbmessage["body"], $PHORUM["DATA"]["LANG"]["mod_foo"]["Disclaimer"]) === false) {
            $dbmessage["body"] .= "\n".$PHORUM["DATA"]["LANG"]["mod_foo"]["Disclaimer"];
        }

        return $dbmessage;
    }

Prev | Up | Next
| Home |