3

I came up short on good ways to filter a user list to only show users who's birthday is today.

There has been efforts in D6 but nothing in D7?

As a "hack" I used an exposed filter for the birthday field (a date field) and then created a link from a block using PHP code:

$today = date("m-d", strtotime("today"));
print '<a href=/members/birthday?birthday='.$today.'>Today\'s Birthdays</a>';

Ideally, I would like to override the input field with a select option to show " yesterday, today, tomorrow, next week".

Are there any better options doing this in D7?

  • 3
    Doesn't a regular date filter already support doing a check for field_birthday == now with granularity? I guess not by the long issue you linked to, but right away, I don't see the problem? – Letharion Apr 20 '12 at 17:56
  • yeah, you are right, I can do that with the "user created" date field. Not sure what went wrong, I select the "date" type and the field list shows that it's "Date (module: Date)" – uwe Apr 20 '12 at 22:49
1

Based on the comments, it seems like you already have an answer, so I'm posting it as such.

A regular date filter already has support for doing a check for field_birthday == now. You can granularity, such as hour, day, week, and even do simple arithmatic, "now + 1 day" and similar.

| improve this answer | |
  • 7
    turns out that I didn't have the "date views" module installed. Once I did that I could select a date and it now shows a date widget as exposed filter. – uwe Apr 21 '12 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.