Yup and I tried to finally found a fix:
change the original file edit to this:
FILE EDITS:
private.php
**find
PHP Code:
// #############################################################################
if ($templatename != '')
{
**ABOVE ADD
PHP Code:
// ############################### delete unread pm ############################
if ($_REQUEST['do'] == "deleteunread")
{
$pm = $_GET['pm'];
// check to see if it is still unread and the user hasn't dilly-dallied
$pmquery = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "pm WHERE pmid='$pm'");
$pmnum = $DB_site->num_rows($pmquery);
if ($pmnum == 0)
{
$idname = $vbphrase['private_message'];
eval(print_standard_error('invalidid'));
}
$pmquery = $DB_site->query("SELECT * FROM " . TABLE_PREFIX . "pm WHERE pmid=$pm AND messageread=0");
if ($DB_site->num_rows($pmquery) == 0)
{
eval(print_standard_error('hasbeenread'));
}
// check to the actual sender of the PM is the one trying to delete it. Done by chris
$suspectuser = $bbuserinfo['userid'];
$senderquery = $DB_site->query("SELECT userid, touserid FROM " . TABLE_PREFIX . "pmreceipt WHERE pmid=$pm AND readtime=0");
$senderresult = mysql_fetch_assoc($senderquery);
if ($senderresult['userid'] == $suspectuser) {
$receiptSql = "UPDATE " . TABLE_PREFIX . "pmreceipt SET deleted=1 WHERE pmid=$pm";
$DB_site->query($receiptSql);
$reduceunreadPmSql = "UPDATE " . TABLE_PREFIX . "user SET pmunread=pmunread-1 WHERE " . $senderresult['touserid'];
$DB_site->query($reduceunreadPmSql);
$reducetotalPmSql = "UPDATE " . TABLE_PREFIX . "user SET pmtotal=pmtotal-1 WHERE " . $senderresult['touserid'];
$DB_site->query($reducetotalPmSql);
$deletePmSql = "DELETE FROM " . TABLE_PREFIX . "pm WHERE pmid=" . $pm;
$DB_site->query($deletePmSql);
$url = "private.php?$session[sessionurl]do=trackpm";
eval(print_standard_redirect('deleted_private_messages_successfully'));
}
else {
$idname = $vbphrase['private_message'];
eval(print_standard_error('invalidid'));
}
}
If you have users which have already a PM count problem run the following querries on them depending which count is off use one of them or both for each affected user:
Code:
UPDATE user SET pmunread=pmunread-1 WHERE userid='<<recipient>>';
UPDATE user SET pmtotal=pmtotal-1 WHERE userid='<<recipient>>';
replace '<<recipient>>' with the userid nbr.
HTH
cheers