I've been pondering ways to integrate this module with the Validate Age module. I had PM'd Gwen (the creator of Validate Age) but haven't heard back from her.
I've basically been reading through the code for both modules trying to decipher how each work, and how they could work together. It seems like it would be rather simple to get both to read the same field in the database since they both deal and revolve directly around a date (a birthday).
Here's my thoughts so far...
Validate Age requires you to make the table in the profile yourself, and to require it be entered on new user registration and require it to be filled. Validate Age lets you choose the table to validate against.
Birthday's module makes a table itself, but doesnt give you the option to make it required during registration. As best I can tell, this is going to be mandatory if Validate Age is going to validate an age during new user registration.
The Birthday's module doesnt give you the option to pick which table to use, but uses a table called 'DOB'.
My first thought was that I could solve this simply by creating a table in the profile called 'dob' and requiring users to enter information, and making it a required field when signing up. Then, installing the Validate Age module to test that this field works... Next, Installing the Birthday's Module which attempts to create a table called 'dob' if one doesnt already exist. I had thought that doing it in these steps would cause the Birthday Module to use the existing 'DOB' table I created for Validate Age and just pull the dates out of that.
... It didnt work like that :(
My guess is that Validate Age, and the Birthday Module store the information in the table in different formats, so even though the information was there each module couldnt read the data the other module had placed there.
So, Im not sure where to go from here. Im not a programmer, and I've never built a Drupal Module... but I had thought that I could change the DB queries inside of the Birthday Module to pull from the table of my choosing. I havent tried this yet, but I realized that there are other things which I'm less comfortable handling.
I'm just adding this as a feature request, so maybe someone can combine the best of both worlds. :-)
Comments
Comment #1
maartenvg commentedThis morning I posted a reply, but Drupal had a minor hick-up, so here I try again:
Thanks for posting this elaborate feature-reply. In another issue others also opted for integration with the Validate Age module, otherwise people have to fill in their birthday twice.
Your feature will definitely be looked at, after we release a stable, official release. After that we are going to introduce multiple features which are all related to this feature: birthday on registration, integration with the profile-module, options for making the birthday optional or required, and so on.
I believe that when most of this is done, integrating it with Validate Age, isn't all that hard anymore. Especially after your analysis.
Comment #2
drazzig commentedThis looks very interesting, however, I have to stress again why I decided to create a new 'dob' table using the MySQL date field.
The profiles module stores dates as an array like this: {s:3:"DOB";a:3:{s:5:"month";s:1:"2";s:3:"day";s:1:"9";s:4:"year";s:4:"1901";}
The Birthdays module stores it in a MySQL date field in the format YYYY-MM-DD .
Not being an expert in SQL, and because I believe that the database should do all the hard work (we shouldn't have to dump all the table into PHP to play around with it in an array, that would be very inefficient and probably impossible for large user communities), how could we generate SQL to filter the next 6 birthdays or birthdays in the next 7 days coming up easily? At the moment, the Date field allows us to use all the date functions in MySQL to do this, but I don't think this will be easy or possible with the way the profiles field stores dates.
Open to any ideas on this, not being an expert on all the functionality SQL provides, I may be missing something, but any solution will have to be SQL based so the database can do all the hard work!
Comment #3
maartenvg commentedYou can automatically generate a date from that array with MySQL. It won't be as pretty as it is now of course, but I believe it weighs against the advantages we'll get from the possibilities it generates.
Another option is to use 2 tables, or to look for ways to fool the profiles module to use a table of our own.
Comment #4
maartenvg commentedAs Birthdays has integrated with the Profile module, it also works perfectly with Validate Age as expected.
All you have to do is use the same profile field for both modules. I've tested it (and is activated on the demo site, try to make a user younger than 5 years) and it works fine.