3.14.3. after_edit

This hook can be used for sending notifications or for making log entries in the database when editing takes place.

Call time:

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

Hook input:

An array containing message data (read-only) 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_after_edit($dbmessage, $orig_message)
{
    global $PHORUM;

    // If the message editor is not the same as the message author, alert
    // the message author that their message has been edited
    if ($PHORUM["user"]["user_id"] != $dbmessage["user_id"]) {
        $pm_message = preg_replace(
            "/%message_subject%/",
            $dbmessage["subject"],
            $PHORUM["DATA"]["LANG"]["mod_foo"]["MessageEditedBody"]
            );
        phorum_db_pm_send(
            $PHORUM["DATA"]["LANG"]["mod_foo"]["MessageEditedSubject"],
            $pm_message,
            $dbmessage["user_id"]
            );
    }

    return $dbmessage
}