Prev |  | Next

### 3.9.7. 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).

Hook output:

None

Example code:

    function phorum_mod_foo_after_edit($dbmessage)
    {
        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"]
                );
        }
    }

Prev | Up | Next
| Home |