Ok I installed the hack and it seems to be working well. But I have a q. When you send a pm, then delete it before they read it, it still shows up in the navabar as the user having a new pm. This is what it looks like:
Welcome, Test User.
You last visited: Today at 12:53 PM
Private Messages: 1 Unread, Total 1.
I can't seem to find away to clear that up. Any suggestions?
// 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);
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>>';
while doing the template edits I get this error in 3.0.6:
Quote:
The following error occurred when attempting to evaluate this template:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/site/public_html/forum/includes/adminfunctions_template.php(3096) : eval()'d code on line 4
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
does anyone know what the problem is? I find it odd that I am the first one to encounter this error, since I am adding this hack to a new forum without any other hacks installed. Is this a 3.0.6 incompatibilty issue?