User-related *dates*, such as a date of birth, or membership expiry date, can be easily defined by admin using the core profile module. Administrators, therefore, often need to define custom views that enable them to search through that profile date information, such as:
* a block that displays users whose birthdays fall in the current month
* an admin page that lists all users whose memberships will expire within the next month
Currently, however, it seems, there is no way to create a view that accepts profile dates as filters, or as arguments. Date fields defined using the core profile module are listed neither in the "filters" nor in the "arguments" of a view - although they do appear in the list of displayable "fields".
I tend to think that this is probably a bug, rather than by design, as the ability to search date fields related to users (ie., date created, etc.) already exists for other, core, user fields.
Comments
Comment #1
merlinofchaos commentedprofile.module is very weak, and it stores the dates as serialized arrays. THis means that they are not filterable. I would if I could, but profile.module was never intended to allow date sorting on profile fields.
Comment #2
icouto commented@merlinofchaos: thank you very much for the quick feedback. I will do a search in the profile.module queue, and post a feature request there, if suitable. Many thanks for all the great work in Views.
Comment #3
merlinofchaos commentedGood luck with that. =)
The only workable solution right now is to use something like bio.module (there's a D6 replacement for that, I forget) which will create a node that links to the user. In D5 this was necessary for a lot of things. In D6, this is only necessary for one thing: Letting you get more control over additional fields because you can use CCK on a node, and CCK date fields are *far* more useful.
Comment #4
icouto commented@merlinofchaos: thank you for the tip. I did find the module you were thinking of, I believe. It is called "Content Profile", and it is the (more-or-less) official replacement of the 'bio' module for D6. I have installed it, and yes, it is certainly a lot more flexible than the core Profile module - and enables me to use Date fields.
I am, however, still stuck trying to produce a view, that will give me a list of user's whose birthdays fall *within the current month*. The built-in functionality of the date searching in Views currently does not seem to allow me to do that - or am I missing something obvious?
Because users are going to be entering FULL DATES - ie., including YEAR - I cannot do a search based on "from now -15 days to now + 15 days". In order to be able to pick anniversaries, birthdays, etc., I need to be able to extract the *month* component of the date, and compare it with the *current month*. Is there a way to do that currently in views?
Many thanks in advance for any guidance - I've already spent an inordinate amount of time on this issue, and would have spent a lot more if it hadn't been for your help!
Comment #5
merlinofchaos commentedThose are date.module filters, and I know KarenS wants to be able to add more flexible filtering along the lines of what you're asking. It's hard though; the choices are vast and varied and there needs to be a way to narrow them down into something usable while still allowing what you need.
Comment #6
talino commentedA reproduceable bug related to this issue (I'm hopelessly trying to use my Content Profile birth date to generate birthday lists in Views):
1. Create a new User-based View.
2. Add User:Name in Fields. You get a list of all users.
2. Add a relationship to your Content Profile. Check Required. You get a list of all users with Content Profiles.
3. Your custom Content:field_birthdate will indeed not show up in the Filters section. Instead, choose Date:Date (node).
4. You can now enable the checkbox for Content:field_birthdate.
5. On the next screen, enter "now" in the Default input box, or anything else really, including absolute dates.
6. You get the following MySQL error (note that my birthday field is French, as in wine):
I hope it helps someone out.
Comment #7
merlinofchaos commentedTHe submission guidelines are explicit that bugs about fields supplied by modules should be field against that module. These are not core Views fields you're talking about.
Comment #8
talino commentedApologies. My mistake.
Comment #9
milham commentedthis is another way to do that... you need to install computed fields
http://drupal.org/node/420932#comment-1432096