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
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
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
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.