I had a query by PM regarding when the greeting is posted...
The messages get posted ~4 hours after midnight of the person receiving the greetings timezone.
The idea being they get the greeting on the morning of their birthday.
Obviously subject to the vagaries of the cron job system.
As we have members across the planet this was an important idea.
The code that makes it happen is this...
Code:
// Get all possible birthdays today in members timezone after 4:00am members timezone
// vBulletin formats birthday as mm-dd-yyyy (yyyy = 0000 is year if supressed)
$birthdays_db = $vbulletin->db->query_read("SELECT userid, username, usergroupid, birthday, showbirthday, posts, timezoneoffset,
DATE_FORMAT(DATE_ADD(UTC_TIMESTAMP(), INTERVAL ((timezoneoffset - 4)*60) MINUTE), '%D of %M') AS BDisplay,
(DATE_FORMAT(DATE_SUB(UTC_TIMESTAMP(), INTERVAL (timezoneoffset - 4) HOUR), '%Y') - SUBSTRING(birthday,7,4)) AS UserAge
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE DATE_FORMAT(DATE_ADD(UTC_TIMESTAMP(), INTERVAL ((timezoneoffset - 4)*60) MINUTE), '%m-%d%%')
AND showbirthday > '1'
AND usergroupid NOT IN (".$vbulletin->options['APbirthday_excludeug'].")
AND userid NOT IN (SELECT " . TABLE_PREFIX . "ap_birthday.userid FROM " . TABLE_PREFIX . "ap_birthday)
");