PDA

View Full Version : Keep PM's in database permanently, even if deleted by user


ceedee
10-04-2007, 04:20 PM
Hi all,

I am currently running the "Read PM's" mod on my forum which is great. However if a user deletes a PM it of course deletes it from the database, and therefore Read PM's can't see it.

Is there anyone out there who can create a mod for the PM system such that when a user deletes a PM, it just hides it from them (as though it were deleted, but it permanently remains in the database)? It also needs to make the system that counts how many PMs a user has ignore the 'hidden' PMs so that they don't constantly get warned about being at their PM storage limit.

That would be wonderful if one of you could write something that does that!

Cheers,

Chris :)

Analogpoint
10-04-2007, 04:29 PM
From a technical standpoint, that would be no big deal, but I don't know, you might have some legal/privacy issues with it, unless you fully disclose what's going on.

WhaLberg
10-04-2007, 04:45 PM
And some minor database changes might do this.

Marco van Herwaarden
10-05-2007, 06:21 AM
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:

// 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);

Hornstar
10-08-2007, 01:40 AM
I doubt read pm mod would work if the above was done, you would need to search through your database manually instead of using the read pm mod if you do this, unless you get the read pm mod modified. may be wrong tho.