MyBB Community Forums

Full Version: Where is code for 'one-notification-per-thread-until-next-visit'?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I know that MyBB implements a policy of 'one-notification-per-thread-until-next-visit' to limit the email load on the server and the user.

I would like to try modifying this behaviour so that notifications are sent regardless of the forum being visited. This could be suitable for us as our forum is very low volume.

Please will one of the developer's direct me to the code that implements this behaviour?

Best regards

David
Threads subscriptions

Filename: inc/datahandlers/post.php
Line: 934
Code:
$query = $db->query("
                  SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.subscriptionkey
                  FROM ".TABLE_PREFIX."threadsubscriptions s
                  LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
                  WHERE s.notification='1' AND s.tid='{$post['tid']}'
                  AND s.uid != '{$post['uid']}'
                  AND u.lastactive>'{$thread['lastpost']}'
              ");

Remove: AND u.lastactive>'{$thread['lastpost']}'

Forums subscriptions

Filename: inc/datahandlers/post.php
Line: 1364
Code:
$query = $db->query("
                      SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate
                      FROM ".TABLE_PREFIX."forumsubscriptions fs
                      LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=fs.uid)
                      LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
                      WHERE fs.fid='".intval($thread['fid'])."'
                      AND fs.uid != '".intval($thread['uid'])."'
                      AND u.lastactive > '{$forum['lastpost']}'
                      AND g.isbannedgroup != 1
                  ");

Remove: AND u.lastactive > '{$forum['lastpost']}'
That's very helpful. Thank you very much,

David
Hi

I have made the code modification suggested above. However, for a particular forum, some of our users are still not receiving notifications for new threads, despite being subscribed to the forum.

I should mention that we also use the Automatic Subscriptions plugin.

This is very frustrating for our users and I am have no idea how to fix it. It really is important for our users to receive notifications. Otherwise they will lose confidence in the system.

I would be very grateful for suggestions on how to debug this problem. What should I look at please?

Best regards

David
Hi!

I am interested in implementing the changes in the code so users can decide if she/he get all notifications.

Would it be OK (compatibility within forum engine) if I add extra column to users table, something like "all_notifications" (True/False) and make following changes in the mentioned code:

Threads subscriptions

Filename: inc/datahandlers/post.php
Line: 1364
$query = $db->query("
                       SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate
                       FROM ".TABLE_PREFIX."forumsubscriptions fs
                       LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=fs.uid)
                       LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
                       WHERE fs.fid='".intval($thread['fid'])."'
                       AND fs.uid != '".intval($thread['uid'])."'
                       AND (u.lastactive > '{$forum['lastpost']}' OR u.all_notifications = TRUE) -- here is the change
                       AND g.isbannedgroup != 1
                   ");

Forums subscriptions

Filename: inc/datahandlers/post.php
Line: 1364
$query = $db->query("
                       SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate
                       FROM ".TABLE_PREFIX."forumsubscriptions fs
                       LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=fs.uid)
                       LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
                       WHERE fs.fid='".intval($thread['fid'])."'
                       AND fs.uid != '".intval($thread['uid'])."'
                       AND (u.lastactive > '{$forum['lastpost']}' OR u.all_notifications = TRUE) -- here is the change
                       AND g.isbannedgroup != 1
                   ");
thats nice Shade Smile