I tried to post this to the project module, but got an error.
So hopefully the devs see this.
Occassionally I see a user with "-1" unread messages. It happened to me recently also, but I'm not sure how it happens.
In any case, I would suggest the following changes to stop it happening.
$sql = "user_new_privmsg = user_new_privmsg - 1 WHERE user_new_privmsg > 0";
$sql = "user_unread_privmsg = user_unread_privmsg - 1 WHERE user_unread_privmsg > 0";
$db->sql_query("UPDATE ".$user_prefix."_users SET $sql AND user_id = ".$userinfo['user_id']);
That should make sure that it never falls below zero.
Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Last edited by hybrid on Mon Sep 22, 2014 5:27 am; edited 2 times in total