Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2017
Posts: 15
Newbie
Newbie
Offline
Joined: Jun 2017
Posts: 15
Multiple birthday emails fixed by adding this at the top of trigger_birthday_notifications() in libs/triggers.inc.php (right after globals):

Cause of multiples:
The forum index page calls the birthday function every time it loads. On a busy day many users (and bots) visit the index → the function runs many times → each run tries to send emails to everyone whose birthday is today.

Code
PHP// Skip if already sent today
$query = "SELECT CACHE_VALUE FROM {$config['TABLE_PREFIX']}CACHE WHERE CACHE_FIELD = 'birthdays'";
$sth = $dbh->do_query($query, __LINE__, __FILE__);
list($sent_today) = $dbh->fetch_array($sth) ?: [''];
if ($sent_today === $today) {
    return;
}

Why the fix stops duplicates:
The added check looks at the CACHE 'birthdays' value before doing anything.
If it already matches today’s date, the function stops immediately.
The first run of the day sends one email to each user who has a birthday today and then sets the CACHE value. All later runs see the updated value and skip the whole process.
This way every qualifying user gets exactly one email, and no duplicates are sent.

Backup your files first. Test with page reloads.
Kept "Send birthday email" disabled until patched, because until it's patched, multiple emails will be sent.


The Stovebolt Geek
https://www.stovebolt.com/ubbthreads/ubbthreads.php

Server Information
UBB.threads Version 8.0.0
Release 20240826
Server OS Linux
Server Load 0.11
Web Server Apache/2.4.37
PHP Version 8.3.11
MYSQL Version 8.0.39
Database Size 1.94 GB
Sponsored Links
Entire Thread
Subject Posted By Posted
Suggestion: Prevent duplicate birthday emails with sent flag stoveboltgeek 12/27/2025 8:50 PM
Re: Suggestion: Prevent duplicate birthday emails with sent flag stoveboltgeek 01/01/2026 7:08 AM
Re: Suggestion: Prevent duplicate birthday emails with sent flag stoveboltgeek 01/01/2026 7:00 PM
Re: Suggestion: Prevent duplicate birthday emails with sent flag stoveboltgeek 01/03/2026 8:55 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
• Shock Hosting
• Stable Host
• bluehost
• InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,156
Joined: July 2001
Forum Statistics
Forums63
Topics37,583
Posts293,957
Members13,826
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 18578
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 6
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
isaac 2
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20261026)