Warning: The author of this contribution does not provide support for it anymore.

phpBB Digests

Bug in digests affecting daily and weekly digests - phpBB Digests

Bug in digests affecting daily and weekly digests

by MarkDHamill » Wed Feb 24, 2016 5:07 pm

There is an error in mail_digests.php that goes back many versions. The basic issue is that daily and weekly digests are calculating the daily or weekly range based on an offset from GMT. Since post times are stored in server time, not GMT, unless your server timezone is set to GMT, subscribers will not see the right time slice of posts.

To fix the issue (using Digests 2.2.27 as an example) look for these lines around 247-256:

Code: Select all

else if ($weekly_digest_sql <> '')   // Weekly
{
   $date_limit = $gmt_time - (7 * 24 * 60 * 60);
   $date_limit_sql = ' AND p.post_time >= ' . $date_limit . ' AND p.post_time < ' . $gmt_time;
}
else   // Daily
{
   $date_limit = $gmt_time - (24 * 60 * 60);
   $date_limit_sql = ' AND p.post_time >= ' . $date_limit. ' AND p.post_time < ' . $gmt_time;
}


Change to:

Code: Select all

else if ($weekly_digest_sql <> '')   // Weekly
{
   $date_limit = $time - (7 * 24 * 60 * 60);
   $date_limit_sql = ' AND p.post_time >= ' . $date_limit . ' AND p.post_time < ' . $time;
}
else   // Daily
{
   $date_limit = $time - (24 * 60 * 60);
   $date_limit_sql = ' AND p.post_time >= ' . $date_limit. ' AND p.post_time < ' . $time;
}


I will republish the 2.2.27 digests archive shortly. This bug is also in the Alpha digests extension and will be corrected.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA