Option to validate existing profile date field

xibun - March 5, 2009 - 12:05
Project:Validateage
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

I have already a "Date of Birth" field generated by the profile.module. For my site I would prefer to enable the validation for that field.

Can we add an option to point to that field?

There is a similar feature in the birthday.module. (http://drupal.org/project/birthdays)

#1

xibun - April 13, 2009 - 07:48
Title:Option to validate existing date field» Option to validate existing profile date field
Category:feature request» task
Status:active» needs review

have created the patch myself with some external help. please update the dev version.

AttachmentSize
validateage.diff 3.78 KB

#2

gwen - April 22, 2009 - 14:23

I don't have time right now to test the patch, but if some folks in the community feel like doing so, please update this issue once it's been done so I can know whether I should apply the patch or not. Otherwise, I'll test when I have a little more time.

#3

Tally - May 20, 2009 - 05:28

I installed the patch and tested it on a version 6.11 install. I am running the birthdays module and using a birthday field in my profile, which is based on the core profile module.

The patch seems to work OK with respect to integrating with the birthdate field in the profile.

Looking at the validateage table, I notice that new users are added, but the date fields are 0. This makes sense since the patch enables using a profile field for birthdate and that is what I am using.

#4

evilgenius - July 22, 2009 - 20:05

I installed the patch. It works ok but one thing I noticed is that I cannot change the the date of birth that's already filled, including mine. I logged in as user 1 (admin superuser) but still I cannot change any date of birth. I tested it in my development site and my date of birth is now stuck at year 2002!

Update: Disregard. Only true if the date I'm trying to update falls below my minimum age requirement.

So far so good! Hope to see stable version soon!

#5

dafeder - August 9, 2009 - 18:57

This patch did not work for me, it accepted an age well below the minimum I'd set. I wonder why the module author decided to stop providing CCK support?

#6

xibun - August 9, 2009 - 19:35

@ dafeder: can you send me your patched file & settings?

#7

dafeder - August 9, 2009 - 19:36

Here is a patch of the modifications I made. I suspect that the problem was due to a difference in date formats - the date field needs to be abstracted or something. This one doesn't look up the field name, just has "field_birthdate" hardcoded. Will try to come up with a better patch if there is more interest.

AttachmentSize
validateage_cck2.diff 3.6 KB

#8

dafeder - August 9, 2009 - 19:41

xibun thanks for the response - I'm not sure which settings you're asking for but here is a dump of the $edit array that might be usefull..

AttachmentSize
validateage_editdump.dafeder.txt 3.95 KB

#9

LatinBoy - October 21, 2009 - 16:42

This is what i was looking for! Thanks xibun and dafeder! I'm gonna try it!

#10

LatinBoy - October 23, 2009 - 02:22

I installed the patch (#1). I'm agree with evilgenius's comments. Also, I tried the last patch (#7) but it didn't work (I replaced "field_birthdate" with my field name). ¿Am i doing something wrong?

#11

xibun - October 23, 2009 - 12:08

@LatinBoy: what exactly do you agree with evilgenius's comment? his statement is: "good!". so you think it is RTBC?

#12

LatinBoy - October 23, 2009 - 16:24

Yes! The first patch works for me . I'm using Drupal 6.14 and i don't see problems. For me, it is RTBC. thank u very much xibun for this patch!

#13

xibun - October 24, 2009 - 11:10
Status:needs review» reviewed & tested by the community

@Tally: thanks for pointing out the "empty" date entries added to the validateage table in case of profile date field usage - attached a new patch which removes this unnecessary "data collection"
@dafeder: this patch is about profile date field support, I know that CCK (actually fields) is the future, but this should be handled in a separate issue
@LatinBoy: I'm glad I was able to help :). you might also be interested in: #435308: Special message for users indicating current year's birthday
@gwen: I mark this RTBC as is has been confirmed to be working by three other users

AttachmentSize
validateage_2.diff 4.16 KB
 
 

Drupal is a registered trademark of Dries Buytaert.