Prev |  | Next

### 3.12.4. before_delete

This hook allows modules to implement extra or different delete functionality.
The primary use of this hook would be for moving the messages to some archive-area instead of really deleting them.

Call time:

In `moderation.php`, just before deleting the message(s)

Hook input:

An array containing the following 5 parameters:

- `$delete_handled`: default = `false`, set it to true to avoid the real delete afterwards
- `$msg_ids`: an array containing all deleted message ids
- `$msgthd_id`: the msg-id or thread-id to be deleted
- `$message`: an array of the data for the message retrieved with `$msgthd_id`
- `$delete_mode`: mode of deletion, either `PHORUM_DELETE_MESSAGE` or `PHORUM_DELETE_TREE`

Hook output:

Same as input.
`$delete_handled` and `$msg_ids` are used as return data for the hook.

Example code:

    function phorum_mod_foo_before_delete($data)
    {
        global $PHORUM;

        // Store the message data in the module's settings for
        // future use.
        $PHORUM["mod_foo"]["deleted_messages"][$msgthd_id] = $message;
        phorum_db_update_settings(array("mod_foo" => $PHORUM["mod_foo"]));

        return $data;
    }

Prev | Up | Next
| Home |