Prev |  | Next

### 3.9.9. after_message_save

This hook can be used for performing actions based on what the message contained or altering it before it is emailed to the subscribed users. It is also useful for adding or removing subscriptions.

Call time:

In `include/posting/action_post.php`, right after storing a new message and all database updates are done.

Hook input:

An array containing message data.

Hook output:

Same as input.

Example code:

    function phorum_mod_foo_after_message_save($message)
    {
        global $PHORUM;

        // If the message was posted in a monitored forum, log the id
        if (in_array($message["forum_id"], $PHORUM["mod_foo"]["monitored_forums"])) {
            $PHORUM["mod_foo"]["monitored_messages"][$message["forum_id"]][] = $message["message_id"];
        }

        return $message;
    }

Prev | Up | Next
| Home |