Prev |  | Next

### 3.5.3. pm_before_send

(Phorum 5 >= 5.2.15)

This hook can be used for doing modifications to PM message data that is stored in the database. This hook can also be used to apply checks to the data that is to be posted and to return an error in case the data should not be posted.

Call time:

Just before the private message is stored in the database.

Hook input:

An array containing private message data. The fields in this data are "subject", "message", "recipients" and "keep".

Hook output:

The message data, possibly modified. A hook can set the field "error" in the data. In that case, sending the PM will be halted and the error message is shown to the user.

Example code:

    function phorum_mod_foo_pm_send_init($message, $action)
    {
        if ($message['error'] !== NULL) return $message;

        // Enable "keep copy" option by default.
        if ($action === NULL) {
            $message['keep'] = 1;
        }

        return $message;
    }

Prev | Up | Next
| Home |