View Full Version : Birthday Condition?
Is there any easy way to check if today is a poster's birthday using a condition?
I'm thinking it might be nice to put a birthday cake icon next in the postbit if it's that person's birthday...
Tony G
02-11-2004, 03:31 AM
That is possible, I don't know how simple though. I'm thinking of a very simple way to do it but I might be missing a step. Plus there may be no variable to call someone's birthdate data.
Hi Tony,
Thank you for your response.
At least in the postbit template (where I'd be using the birthday cake icon), it looks like $post[birthday] will get you the poster's birthday information. I guess the toughest part then would be to somehow compare that date with today's date using only the month and day portions of the two variables (eg "02-11-1960" and "02-11-2004" needing to be "equal" to set off the condition). Now that I think of it, I don't know if this is possible just with templates as there'll most likely be a need to take the substring of the date(s) -- something that vBulletin doesn't allow without hacking as far as I know...
Logikos
02-11-2004, 03:33 PM
Your right akiy, that would require hacking the /includes/functions_showthread.php if im not mistaking. Maybe you could get a respond at vb.org. Something i prolly would use.
I just went and created a hack and then went to post it onto vbulltin.org. I found out that someone had already posted a hack very much like it:
https://vborg.vbsupport.ru/showthread.php?t=52897
Although the hack in the thread above was released for vBulletin 2.3.x, it was easy enough to place the code into construct_postbit() in functions_showthread.php in 3.0.0 RC4. The hack also allows you to place a birthday cake icon up to a week before the person's birthday. It was easy enough to modify the code to only show the birthday icon on the day of the birthday...
Tony G
02-12-2004, 08:05 AM
Glad you got it sorted out. :)
NuclioN
02-12-2004, 09:14 AM
It doesn't work in our RC4 but it could very well be that the code is at the wrong spot. Can you show us where to put the and 'what' code?
Logikos
02-12-2004, 12:21 PM
[QUOTE=akiy] it was easy enough to place the code into construct_postbit() in includes/functions_showthread.php in 3.0.0 RC4.QUOTE]
My guess is to look for construct_postbit()
Thanks for the corrected path to functions_showthread.php, Nemesis.
I don't want to get too deep into this hack since, after all, this is vBulletinTemplates.com, after all...
But, I basically just edited includes/functions_showthread.php.
After:
// IM icons
construct_im_icons($post);
I added:
// Birthday cake in postbit HACK
if (substr($post['birthday'], 0, 5) == vbdate("m-d")) {
$bdaycake = " <img src='/graphics/birthdaycake.gif' width='18' height='19' border='0' align='absmiddle' alt='Today is my birthday!'> ";
}
// END Birthday cake in postbit HACK
I then used $bdaycake in the postbit and postbit_legacy templates where I wanted the cake icon to show.
Hope that helps!
Logikos
02-12-2004, 07:54 PM
Good deal :)
asasi
12-23-2005, 01:18 PM
good work! but ..
could you set it in a way that notice the birthday one week before it's date ?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.