Fix broken PM (Private messages) (#1085)

This commit is contained in:
Cønstantine Kovalensky 2023-11-12 01:48:44 +04:00 committed by GitHub
commit 5f8d7faf83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View file

@ -91,7 +91,7 @@ if ($logged_in && empty($gen_simple_header) && !defined('IN_ADMIN')) {
GROUP BY privmsgs_to_userid GROUP BY privmsgs_to_userid
"); ");
$real_unread_pm_count = (int)$row['pm_count'] ?? 0; $real_unread_pm_count = (int)($row['pm_count'] ?? 0);
if ($userdata['user_unread_privmsg'] != $real_unread_pm_count) { if ($userdata['user_unread_privmsg'] != $real_unread_pm_count) {
$userdata['user_unread_privmsg'] = $real_unread_pm_count; $userdata['user_unread_privmsg'] = $real_unread_pm_count;

View file

@ -668,11 +668,11 @@ if ($mode == 'read') {
do { do {
switch ($row['privmsgs_type']) { switch ($row['privmsgs_type']) {
case PRIVMSGS_NEW_MAIL: case PRIVMSGS_NEW_MAIL:
$update_users['new'][$row['privmsgs_to_userid']]++; ($update_users['new'][$row['privmsgs_to_userid']] ??= 0) + 1;
break; break;
case PRIVMSGS_UNREAD_MAIL: case PRIVMSGS_UNREAD_MAIL:
$update_users['unread'][$row['privmsgs_to_userid']]++; ($update_users['unread'][$row['privmsgs_to_userid']] ??= 0) + 1;
break; break;
} }
} while ($row = DB()->sql_fetchrow($result)); } while ($row = DB()->sql_fetchrow($result));
@ -778,7 +778,7 @@ if ($mode == 'read') {
if ($submit) { if ($submit) {
if (!empty($_POST['username'])) { if (!empty($_POST['username'])) {
$to_userdata = get_userdata($_POST['username']); $to_userdata = get_userdata($_POST['username'], true);
if (!$to_userdata || $to_userdata['user_id'] == GUEST_UID) { if (!$to_userdata || $to_userdata['user_id'] == GUEST_UID) {
$error = true; $error = true;