* * [example] * <hookcode> * function phorum_mod_foo_before_pm_list($folder_id) * { * // Query the db directly and apply custom code * * return $messages; * } * </hookcode> */ if (isset($PHORUM['hooks']['before_pm_list'])) { $list = phorum_hook('before_pm_list', $folder_id); } if (is_null($list)) { $list = phorum_db_pm_list($folder_id); } // Prepare data for the templates (formatting and XSS prevention). $list = phorum_pm_format($list); /** * [hook] * pm_list * * [availability] * Phorum 5 >= 5.2.7 * * [description] * This hook can be used for reformatting a list of * private messages. * * [category]
/** * Delete a private message folder for a user. Along with the folder, * all contained messages are deleted as well. * * @param integer $folder_id * The id of the folder to delete. * * @param mixed $user_id * The user to delete the folder for or NULL to use the active * Phorum user (default). */ function phorum_db_pm_delete_folder($folder_id, $user_id = NULL) { $PHORUM = $GLOBALS['PHORUM']; if ($user_id === NULL) { $user_id = $PHORUM['user']['user_id']; } settype($user_id, 'int'); settype($folder_id, 'int'); // Retrieve the private messages in this folder and delete them. $list = phorum_db_pm_list($folder_id, $user_id); foreach ($list as $id => $data) { phorum_db_pm_delete($id, $folder_id, $user_id); } // Delete the folder itself. phorum_db_interact(DB_RETURN_RES, "DELETE FROM {$PHORUM['pm_folders_table']}\n WHERE pm_folder_id = {$folder_id} AND\n user_id = {$user_id}", NULL, DB_MASTERQUERY); }
/** * This function deletes a folder for a user. Along with the * folder, all contained messages are deleted as well. * @param folder_id - The id of the folder to delete. * @param user_id - The user to delete the folder for or * NULL to use the current user (default). */ function phorum_db_pm_delete_folder($folder_id, $user_id = NULL) { $PHORUM = $GLOBALS["PHORUM"]; $conn = phorum_db_postgresql_connect(); if ($user_id == NULL) $user_id = $PHORUM['user']['user_id']; settype($user_id, "int"); settype($folder_id, "int"); // Get messages in this folder and delete them. $list = phorum_db_pm_list($folder_id, $user_id); foreach ($list as $id => $data) { phorum_db_pm_delete($id, $folder_id, $user_id); } // Delete the folder itself. $sql = "DELETE FROM {$PHORUM['pm_folders_table']} " . "WHERE pm_folder_id = $folder_id AND user_id = $user_id"; $res = pg_query($conn, $sql); if ($err = pg_last_error()) phorum_db_pg_last_error("$err: $sql"); return $res; }