I've been searching around and see that there used to be a birthday.module, but it seems to have been dropped. I'm currently capturing members birthdays (in profile.module) and would love a way to display a block like "birthdays this week." Has anyone done done any work on this or interested in seeing something like this?

- matthew

Comments

boris mann’s picture

Somehow, I think this should be integrated into/extended from the event.module. That is, make a birthday.module that inserts a date field into the user profile screen. Then, have /birthday create a calendar that displays birthdays.

Go for it!

jacauc’s picture

I'm really interested in something like this.
Maybe if it could add the users bday as an "upcoming event" in the event module too. (sorry if i'm repeating what you are saying boris)

http://www.dieinter.net

lennart’s picture

http://drupal.org/node/25564

for info on adding a block that display a happy birthday message

Best regards,
Lennart

Best regards,
Lennart

nautis’s picture

Close. Anyone know a way to tweak this code a bit to direct it to the whole site rather than just to the individual person. What I would like to do is to list all birthdays for a set time period.

- matthew | nautis.com

Mike_R’s picture

To see it in action, visit www.lipstickgirls.co.uk

<?php

$monthnumber = date(n);
$monthstring = "%\\\"month\\\"\\;s\\:".strlen($monthnumber)."\\:\\\"".$monthnumber."%";

$sql = "SELECT u.uid, u.name, u.created, v.value FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = '16' and v.value LIKE '$monthstring'";

$birthdays = db_query($sql);

$users = db_num_rows($birthdays);
$num_bdays = 0;

if ($users > 0) {

for ($count = 1; $count <= $users; $count ++) {

$bdaydata = db_fetch_array($birthdays);

// new code to trap birthday = joined date here

$joinedday = date("j", $bdaydata['created']);
$joinedmonth = date("n", $bdaydata['created']);
$joinedyear = date("Y", $bdaydata['created']);

$joindate = "a:3:{s:5:\"month\";s:".strlen($joinedmonth);
$joindate .= ":\"".$joinedmonth."\";s:3:\"day\";s:";
$joindate .= strlen($joinedday).":\"".$joinedday."\";s:4:";
$joindate .= "\"year\";s:4:\"".$joinedyear."\";}";

if ($joindate != $bdaydata['value']) {

$num_bdays = $num_bdays + 1;

$bday_name[$count] = $bdaydata['name'];

$daystring = $bdaydata['value'];
$bdayarray = explode (";", $daystring);
$bdayday = explode (":", $bdayarray[3]);
$daystring = substr($bdayday[2], 1, strlen($bdayday[2])-2);
$daystring = strtotime($daystring." December 1979");
$bday_day[$count] = date(jS, $daystring);

$bday_uid[$count] = $bdaydata['uid'];

}
}
}

if ($num_bdays > 0) {
array_multisort($bday_day, SORT_ASC, SORT_NUMERIC, $bday_name, $bday_uid);
?>
<table width="100%" cellpadding=5 cols=2>
<?php
for ($output = 0; $output  < count($bday_name); $output++) {
if ($bday_day[$output] == $bday_day[$output-1]) {
$bday_day[$output] = " ";
}
echo "<tr><td width='25%'>".$bday_day[$output]."</td><td><a href='user/".$bday_uid[$output]."'>".$bday_name[$output]."</a></td></tr>\r\n";
}
?>
</table>
<?php

} else {

}
?>

Yes it's a little ugly, but that's because of the string format in which drupal stores dates :/ Had to put some other code in too to bypass the fact that if a user joins up and ignores the "profile_birthday", then it's set to their joined date, which makes them appear on the birthday block when they shouldn't.

To make this work for you, change the v.fid = '16' to whatever the fid is for your birthday field in profile.module.

nautis’s picture

mike -

you are the man! this is exactly what i was looking for. This should be a default block for the profile.module. thanks so much for your work on this.

- matthew

IamPter’s picture

For this. I was just searching for a solution and here it is!

jacauc’s picture

I am still looking for a way to integrate birthdays into the calendar as an event.

I found a module called birthday2.module, but this is very old, and it seems to be dropped from drupal.

Can anyone suggest a way how i can do this please!?

Thanks!!!
jacauc

http://www.dieinter.net

drazzig’s picture

Hi,

Just found this post through my random searches of the forums. I'm coding two modules for my personal site at the moment, birthdays.module and coutries.module that I plan to release asap!

The birthdays module allows users to add their Date of birth very much like the profiles module, but also displays it in a block of upcoming birthdays much like the events module. I thought of integrating it with the events module but I thought it was messy. This is a self contained module. Also, my module allows reminder e-mails to be sent to the administrator of upcoming birthdays with the option of sending automatic e-mails to users on their birthdays (call me lazy but hey!). It shows the user's star sign symbol with a link to Yahoo horoscopes.

The countries module is because most of my friends are from other countries and I wanted to display their respective countries flag next to their name instead of just the coutry name. Allows admin to add and delete coutries from database as the world changes or if I missed some of the smaller ones.

Anyway, let me know if I'm re-inventing the wheel here. These will be my first two contributions to Drupal, kind of a learning experiance, so as soon as I put them in CVS I'd appreciate you guys helping me clean it up and make it better.

Draz.

lennart’s picture

Hi Drazzig,

I would love to test out the countries module over at
www.zensci.com

I have lots of users from different countries - sounds like an interesting module!

Best regards,
Lennart

Best regards,
Lennart

IamPter’s picture

For your birthday module can you allow an option to pull that information from the profile field.

jacauc’s picture

Hi Drazzig,

I would really be interested in such a module :D
Please let me know when you have a beta or final version available.

Thanks!!
jacauc

http://www.dieinter.net

patrickharris’s picture

Countries module sounds great ... WP has several modules for this ... it would be great to have it in Drupal!

Damian_’s picture

I'm interested on your b/d module if you can contact

regards

drazzig’s picture

I'll reply here as several people interested.

Basically, I am in development of both these modules. Countries is nearly finished, just need to add the settings form to add/remove countries and flags from database.

Birthdays module is more complicated. Unfortunately I am very busy at the moment so its been a bit slower, but I am still deciding how to store the dates so that I can make it all work great. Using the unix times doesn't work well for recurring events like birthdays, so I've tried storing the birthdays as day, month and year fields in a database table, but that brings other problems. I will look into it more and write a nice long comment when I have time asking you guys for ideas.

I'm not using the profiles module to store this info. I can see how it could be done by making the settings page point to the field name the user specifies for the country and DOB, but I think they work better as seperate modules. Also, the members module won't show the flags in the list table even if it is in the profile module. I'm kind of hacking my own members module to include the new modules myself. Any input into how I can hook it into the existing modules easily would be great so that I can keep it within the drupal framework and everyone else can use them easily.

Anyway, thanks for all the interest, I am getting it done ASAP as my site is waiting for it before I add all my users and everything else I want! You can post me any specific questions or suggestions here or directly.

IamPter’s picture

Why not use the profile module?

If you look at the registration process of http://www.apockotos.com I ask the birthdate and country of the user. Then you could have a setting in each module where I put in the setting of the which field has this information.

Some of my sites:
http://www.apockotos.com
http://www.knightrider.org
http://www.macmariner.com

igrcic’s picture

Peter Apockotos, that should be the right way to do it...

Drazzig can you post your code, or start new project, so other user can help you with it?

jax’s picture

I actually made a birthday module as an exercise in creating drupal modules. I followed the tutorial but in stead of making what the tutorial said I made a birthday module.

Maybe it can give you ideas about features, possibilities, etc.

http://drupal.org/node/31909

neofactor’s picture

That is nice if you just want to tell them something they already know...
It does add a "sense of personalization" even if pseudo personal... but it is one sided... just focused on the 1 person.

If you have a community... you may want to have a Birthday Block as well. The block would list all the users with a birthday that month... and send them an email wishing them a happy birthday. (To promote you site as well)

Another consideration is what you collect for their birthday.... you may only want to ask them their Month and day... the year is rather "invasive" and a bit to personal if your community has a more mature audience.

Just a few thoughts...

David McIntosh
neofactor.com

IamPter’s picture

A community bithday module is exactly what I was thinking of originally that would show each members birthday and of course a message for these members. Even a specified message that could be different for each day of the year.
And of course a cute little icon that is generated as a cake with the candles matching their age on their person profile node.

Some of my sites:
http://www.apokotos.com
http://www.knightrider.org
http://www.macmariner.com

jacauc’s picture

Have a look at this http://drupal.org/project/birthdays

Think we are close :D