If I want to show only today's birthdays and I put

$birthdays = _get_upcoming_birthdays_days(variable_get("birthdays_days_number", 5));

the module only shows one entry and not the two birthdays on that date. If I ask for a higher number of days, this does not happen.

If anyone finds a workaround, please let me know. Have a nice day,

Felix.

Comments

maartenvg’s picture

Assigned: Unassigned » maartenvg

I haven't got a solution for it at this moment, but the block-code has proven to be buggy. I' m working on a new version which hopefully solves these kind of problems.

felixsmile’s picture

Status: Active » Fixed

Hi!

After some SQL fiddling here I "my" solution, but I think it's a solution we could actually commit to head:

     $result = db_query("SELECT {dob}.uid, month( {dob}.birthday ) AS m, day( {dob}.birthday ) AS d
FROM {dob}, {users}
WHERE {users}.uid = {dob}.uid
AND (
month({dob}.birthday)  = month( curdate( ) )
AND day({dob}.birthday) = day( curdate( ) )
)", $days, $days, $days);

The correspoding SQL request is this one (just for someone who might wonder like I did at the beginning):

SELECT dob.uid, month( dob.birthday ) AS m, day( dob.birthday ) AS d
FROM dob, users
WHERE users.uid = dob.uid
AND (
month(dob.birthday)  = month( curdate( ) )
AND day(dob.birthday) = day( curdate( ))
)

Of course, in case we show more than one birthday, we would have to introduce the order command again, as well as the %s in the two lines concerned.

But otherwise, it works well.

Have a nice day,

Felix.

maartenvg’s picture

Apparently I didn't entirely understand your problem, but I think I do now.

The function call below should give today's birthdays. There is a bug in the current HEAD version, but I'm not sure whether it regards problem. The new version I'm working on right now, works as expected when using the below call.

$birthdays = _get_upcoming_birthdays_days(1)

In my opinion, adding a specific query for when the global one suffices, isn't necessary. But i'll make a function called something like get_todays_birthdays() which does the above action, for use in other modules and themes.

felixsmile’s picture

Hi,

Well, I thought one could use this SQL Query instead of the other one, but I'm not sure which one is faster, maybe the other one. That was all.

Very good the issue is solved in the new version!

Thank you very much, have a nice day,

Felix.

Anonymous’s picture

Status: Fixed » Closed (fixed)