Mod Name / Version - Profile Birthdays 1.5     ver 1.1 fixes a bug where the "Happy Birthday" message repeated with each category.             Lists the usernames in alphabetical order for a neater look.     ver 1.2 update to work with UBB.Threads 6.2, adds the year and age calculation as an option     ver 1.3 updates the age calculation function and fixes a bug.     ver 1.4 fixes a bug where the date of the birthday wasn't displaying     ver 1.5 fixes the age calculation bug. Thanks to Dimopoulos and JustDave for help in nailing that down.
Description - This modification will allow users to enter their birthdays into their profile and display birthday info.
Working Under - UBB.Threads 6.2
Features -
Birthday will Display in their Profile.
Age will appear in their Profile if they have entered the year of their Birth. (Thanks Dimopoulos)
Bottom of Main Index Will Display "Today's Birthdays" and "This
Months Birthdays" if there are any.
Birthday Names will link to the users profiles.
Top of Main Index will wish the User a Happy Birthday if It's their
Birthday.
Bottom of Main Index will offer a link to update their profile if the profile does not contain the Birthday Info
If they have completed their whole birthday, an accurate age will be calculated.
If they have only filled in their birthyear, an aprox. age will be calculated.
Credits - PamW of www.thesoulelement.com for requesting it. Thanks to Dimopoulos for adding the year to the code. Thanks to Dave_L for help with the age calculation.
I'm using the 1.1 mod on threads 6.1.1 and love it. Although it seems that as more of my members add their info (probably a couple thousand of my 18,000 members) the page loads slower. I think there was talk about cache this info ( I would be happy with a once a day look up ).
Q. - Is the additonal lookup time insignificant and I should forget it?
Q. - Should drop it from my Main Index page which is re-loaded many times and just leave the info in a PAL box on IIP?
Thanks... just looking to keep things running smoothly.
It would have to check and load the info each time the Main Index is loaded. That can slow things down I imagine.
I am working on an Updated Pal Box for the next version of IIP which will Cache the info. (Thanks to JustDave!) Next step will be figuring out if we can have the bottom of the index page pull the cached info from IIP. That would be best for sure. Let IIP update it however often it does when it loads, and just have the Main Index use the info.
I've got this all worked out and up and running. Thanks to some great IIP groundwork by JustDave, it was easy.
I've got the BirthdayPal box for IIP 5.2 ready to go. It will cache the birthdays however many minutes you want. You can define it in the IIP config file.
Then, I tweaked the mod for the main index. The only thing the main index will check for, is if it's that users Birthday (so they get a birthday greeting) or if their birthday is empty (so they get the link to fill in their profile). All the big list of names (today's bdays and this months bdays) is pulled from the IIP cache. I figure it's sufficient for the IIP to update that info however often. So the Main Index won't do any pulling of that info.
So I guess you'll have to load IIP at least once so that there's info to read. But if your site is busy, IIP will get loaded at least once a day easily.
That should cut down on the load, caching the bulk of the info.
NOTE: If you are upgrading from the old birthday Mod, you'll already have U_BirthMonth and U_BirthDay, but you'll need to add U_BirthYear, as that was added in this version.
To add U_BirthYear run this:
ALTER TABLE w3t_Users ADD U_BirthYear INT (4) NULL
Otherwise, as Storm discovered, you'll get errors on the show profile page.
If you are using the Pal Box.... and Caching the results.... you can pull that Cached info to the Main Index.... rather than pulling it each time the Main index Loads.
You must be using the Pal Box, and Caching the results.
Hi Josh, jsut a quick not on the previous version (1.1). There is maybe a bug with the calendar entries. It might not be fixed with the 1.2 version : If a user changes the date, say the month from april to may, a new may entry is added to the calendar. and the april entry stays. Looks like a bug to me.
What you are seeing is quite weird. In my 6.1.1 board I went and changed my birthday from April to January. Immediately in my calendar board the entry from April disappeared and appeared in January.
What the calendar modification on the profile birtdays does is it queries the users table for birthdays on a particular month and while the script runs to display the data in the calendar it also displays the birthday. The w3t_events table is never used for birthdays.
Very weird that your users see the events.... Did you or your users manually entered events on the calendar board? To check this, see the color of the three little arrows in front of the person's name on the particular date. If they are blue, it was generated by this modification if Red then it was manually entered in the w3t_events table as a new event.
Any chance of having a sample to have a look at the behavior?
What I had done was just use the year to calculate age. Duh.... everyone's a year older come the first of the year.
What I did was convert the bday to epoch time, and subtract from current date, then calculate the age. Then I have it where they have selected the age, but not a birthday or month, it will say "aporx. age" and just figure the difference in the years.
Maybe you like this variant of the YEAR calculation in showprofile.php (This spares the extra "age"-lines on the showprofile.tmpl)
// -------------------- // Figure out how old they are if ($BirthYear) { $age = date("Y") - $BirthYear -1; //(modifiziert!) $birthday .= " $BirthYear ($age)"; }
Hi Nikos, I tried to put your "Show Birthdays in Calendar" in the new Calendar 6.2 Hack version. Can you help me where to integrate your fabulous hack inside the calendar hack? - Could not get it running there was a problem with the UBirthDays = $d mysql request at the place it was before.
(By the way, Gardener, it is confusing to me, that there are two open threads on calendars now: a 3.0 and a 6.2. - I use the 6.2 version.)
Thanks - works fine - I like the direct link if they have not yet entered their Birthday - a great way to encourage people to fill in the little boxes - who kows they might even update some of the other boxes there as well LOL
Did you add the update to version 1.3 that I posted just after the first of the year.
First I was just going by year, but when the year changed, everyone ended up a year off.
Grab the latest file from the first post in this thread and make the adjustments to the showprofile.php script. I also fixed the bit with the day not showing. Had a typo in a variable or something.
Yours would have worked.... but I remember why I did what I did.... so it doesn't show the day if they don't have a month.
It's flexible, as people sometimes don't want to give all the info.
If they only give the year, it'll say "aprox. age". If they give the Month, it'll only show the month, and at least show them in "this month's birthdays". If they give all 3, then it'll give accurate age, and a birthday greeting.
[]Have you figured out how to integrate Dave's grab birthday fields into yours to fill it automatically? [/]
No I haven't. It kinda confused me. I need to ask Dave to simplify for me, and let me grab the month, day and year, as separate fields. So we can add them in. But I would like to do that.
I just had a hard time following what was happening.
any idea what the age is advanced ? I mean only by a year I'm 34 right now on the 13th I'll be 35 but it's already telling me I'm 35 unless I'v been a year off on my birthday LOL you never know with me
Because initially (in the earlier version) it just took the current year minus the birth year. That caused it to advnace on the switch to 2003. The latest version uses the whole birthday (month, day and year) to calculate the birthday.
I just wasn't thinking when I did it first..... I just figured the difference in the years was the age, but that changed when the year advanced by 1. Everyone got a year older.
If you update the code to the latest version, it'll figure the exact age, if you've filled in all three fields.
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.