• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

BlogEntry Watch Comment Notifier loads wrong read timestamps

Kirby

Member
AMS Premium
CAS Premium
IMS Premium
LD Premium
RMS Premium
SC Premium
UBS Premium
UBS Version
2.3.11
XenForo Version
2.3.10
PHP Version
8.3.30
Database & Version
MariaDB 10.11.14
Are there any errors being throw?
No
We are getting complaints from users that watched blog entry comment notifications don't work (especially for users who were the last to comment on a blog entry and didn't view the blog entry again after posting the comment).

Looking at the code it seems to me like the notifier loads the wrong read timestamps:

PHP:
$readDates = $db->fetchPairs("
        SELECT user.user_id,
                GREATEST(
                        COALESCE(blog_entry_read.blog_entry_read_date, 0),
                        ?
                )
        FROM xf_user AS user
        LEFT JOIN xf_xa_ubs_blog_entry_read AS blog_entry_read ON
                (blog_entry_read.user_id = user.user_id AND blog_entry_read.blog_entry_id = ?)
        WHERE user.user_id IN (" . $db->quote($userIds) . ")
", [$autoReadDate, $comment->blog_entry_id]);

As far as I understand the code, this gets the timestaps for the blog entries, not for blog entry comments.

So shouldn't this be smth. like
PHP:
$readDates = $db->fetchPairs("
        SELECT user.user_id,
                GREATEST(
                        COALESCE(blog_entry_comment_read.comment_read_date, 0),
                        ?
                )
        FROM xf_user AS user
        LEFT JOIN xf_xa_ubs_comment_read AS blog_entry_comment_read ON
                (blog_entry_comment_read.user_id = user.user_id AND blog_entry_comment_read.blog_entry_id = ?)
        WHERE user.user_id IN (" . $db->quote($userIds) . ")
", [$autoReadDate, $comment->blog_entry_id]);
instead?
 
Last edited:
Back
Top