A PM consists of 2 database entries:
- 1 pmtext row, containing the PM-text and sender/receipant details
- 1 row in the 'pm' table for each sender (Send Items) and 1 row for each receipant.
When someone deletes a PM, only the row in the 'pm' table gets deleted. Once an hour ./includes/cron/cleanup2.php is ran, which will delete all pmtext rows that don't have a row in the 'pm' table anymore.
To keep all PM (text), you could simply remove the coding from cleanup2.php that cleans the pmtext table:
PHP Code:
// Orphaned pmtext records are removed after one hour.
// When we delete PMs we only delete the pm record, leaving
// the pmtext record alone for this script to clean up
$pmtexts = $vbulletin->db->query_read("
SELECT pmtext.pmtextid
FROM " . TABLE_PREFIX . "pmtext AS pmtext
LEFT JOIN " . TABLE_PREFIX . "pm AS pm USING(pmtextid)
WHERE pm.pmid IS NULL
");
if ($vbulletin->db->num_rows($pmtexts))
{
$pmtextids = '0';
while ($pmtext = $vbulletin->db->fetch_array($pmtexts))
{
$pmtextids .= ",$pmtext[pmtextid]";
}
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "pmtext WHERE pmtextid IN($pmtextids)");
}
$vbulletin->db->free_result($pmtexts);