Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2017
Posts: 15
Newbie
Newbie
Offline
Joined: Jun 2017
Posts: 15
Users (including me) sometimes get 14–21 birthday notices. The root cause is likely no uniqueness check or sent flag—emails can re-trigger if cache rebuilds or queries return the same user multiple times.
Simple fix idea:
Add two columns to USER_PROFILE:
SQL
Code
ALTER TABLE {table_prefix}USER_PROFILE 
ADD COLUMN BIRTHDAY_EMAIL_SENT TINYINT(1) DEFAULT 0,
ADD COLUMN BIRTHDAY_EMAIL_SENT_YEAR INT UNSIGNED DEFAULT 0;

In the birthday email sending logic (wherever it mails users):
SQL
Code
UPDATE {table_prefix}USER_PROFILE 
SET BIRTHDAY_EMAIL_SENT = 1, BIRTHDAY_EMAIL_SENT_YEAR = YEAR(CURDATE())
WHERE USER_ID = ?;

In the birthdays.php query, add condition:
SQL
Code
AND (t2.BIRTHDAY_EMAIL_SENT = 0 
     OR t2.BIRTHDAY_EMAIL_SENT_YEAR != YEAR(CURDATE()))
Logic:

Sent=0, year ≠ current → send (new year)
Sent=1, year ≠ current → send (reset for new year)
Sent=0, year = current → send (first time this year)
Sent=1, year = current → skip (already sent)

This ensures one email per user per year. No duplicate sends, no lost emails.
Happy to test or provide diffs if helpful. Just a reliability tweak.


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
AllenAyres
AllenAyres
Texas
Posts: 21,080
Joined: March 2000
Forum Statistics
Forums63
Topics37,583
Posts293,957
Members13,826
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 34299
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 1
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
WebGuy 2
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)