Prev |  | Next

### 3.12.3. after_attach

The primary use of this hook would be for creating an alternate storage system for attachments. You would need to use the ??? hook to remove the file data and in this hook it could be saved properly. You will need to use the ??? hook to retreive the file data later.

Call time:

In `include/posting/action_attachments.php`, right after a file attachment is saved in the database.

Hook input:

Two part array where the first element is the message array and the second element is a file array that contains the name, size, and `file_id` of the newly saved file.

Hook output:

Same as input.

Example code:

    function phorum_mod_foo_reopen_after_attach($data)
    {
        global $PHORUM;

        // Log the messages with attachments, including the
        // attachment names
        $PHORUM["mod_foo"]["messages_with_attachments"][$data[0]["message_id"]][$data[1]["file_id"]] = $data[1]["name"];
        phorum_db_update_settings(array("mod_foo" => $PHORUM["mod_foo"]));

        return $data;
    }

Prev | Up | Next
| Home |