https://drupal.org/sandbox/biged/2007914
git clone --branch 7.x-2.x http://git.drupal.org/project/validateage.git cd validateage
The age verification module forces the user to select an age date to verify that they are old enough to view the site before passing the user back to the selected URL. It has an Admin area to select pages to ignore.
Description from the read me file...
This very basic documentation for during development.
Better docs will be generated closer to a full release.
An age gate verification module that forces the user to select a date
before passing the user back to the selected URL.
1. Admin Display options can be edited from
/admin/config/development/age-verification
2.Relative URL paths can be used for the age verification to ignore pages.
As an example you may have a cookie policy page you do note want
to act on. this might use the alias path of
ww.yoursite.com/cookie-policy simply
add the relative url cookie-policy or node/id
Pages you may want to avoid are user
3.Form description field is used to output any text on the bottom of the form.
In example you may have added a URL to ignore for your cookie policy page
You could add in here HTML
This site uses cookies.
Cookie Policy
Comments
Comment #1
manarth commentedIn the .info file
In the .module file:
@filedeclaration; each author requires a separate@authortag…hook_help: "addeding".hook_menu, the path "age-verification" use the fileage_verification.admin.incbut does not appear to be an admin page. Useage_verification.pages.incinstead.age_verification_url_inbound_alter(), remove the@functiondeclaration - it's not needed. In the same docblock, theImplementssyntax is as follows:Implements hook_foo().: add parenthesis after the hook-name.hook_url_inbound_alter(), which is called bydrupal_path_initialize()in_drupal_bootstrap_full(). This means it won't run for cached pages. The kind of access-control is often handled inhook_boot()- consider moving it there. If it's OK for this to not run in cached pages,hook_init()may also be a better place.In the .admin.inc file:
age_verification_urlsandage_verification_description. You should add a .install file withhook_uninstall()implementations to clean those variables up when the module is removed.@ingroup formsto theage_verification_admin_form()andage_verification_form()docblocks.age_verification_form(), the dob form-element has a max-length attribute, which is not used by thedateFAPI type.age_verification_form(), consider adding a hint to the dob field, to show the format of the date (e.g.'#description' => t('Format: dd/mm/yyyy'),age_verification_form(), the title in the confirmation form-element does not pass throught().age_verification_form(), therequest_uriform element is a hidden field: it's good practice that hidden fields are only used if they need to be changed on the front-end (for example, by JavaScript). A 'value' FAPI type can be used instead.age_verification_form(), consider wrapping the submit button in anactionswrapper: see http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...age_verification_form_validate(), theform_set_error()syntax should beform_set_error($field_name, $error_message);- rather than usingform_set_errorand a separatedrupal_set_message().Comment #2
BigEd commentedThanks a lot for doing that. I already committed a change as I missed something out earlier.
I will go through these and then get back to you.
Is it ok if some of the preferences like the The value '21' are added to the issue queue? these are some interesting feature requests that I would like to add later.
Comment #3
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
RavindraSingh commentedFix the issues in http://ventral.org/pareview/httpgitdrupalorgsandboxbiged2007914git
Comment #5
RavindraSingh commented.installfile is not available to unset the variables like 'age_verification_urls'.Use 'administer age_verification' underscore is missing in
" 'access arguments' => array('administer age verification'),"Age verification form is coded in age_verification.admin.inc file which does not seems for admin configuration only make one more file or write your code in .module file which is not related with admins.
use hook_init() for preventing use to access the pages.
Comment #6
BigEd commentedThanks it.ravindrasingh that's a great help, thanks for your time on this.
All of those I will get added apart from the use hook_init() I will try and play about with it but as this hook is not run on cached pages I may have difficulty here, Unless you have some solutions you can think of?
Comment #7
RavindraSingh commentedHey @BigEd. Below are some points needs work.
1. age_verification_form($form, &$form_state, $request_uri) No use of $request_uri. just remove it. i hv checked the functionality after removing
2. Age limit should be configurable by admin. Do not hard code it.
3. I had mentioned in my previous comment, apart from admin configuration nothing functions should be in admin.inc file make another file with .pages.inc like or use .module itself for front end functionality.
4. Validation issue is their error comes if i got the "You need to be 21 or over to access the site." then click on another link it does not validate again.
5. Add a condition if visitor is on home page.
Comment #8
RavindraSingh commentedHey @BigEd. Below are some points needs work.
1. age_verification_form($form, &$form_state, $request_uri) No use of $request_uri. just remove it. i hv checked the functionality after removing
2. Age limit should be configurable by admin. Do not hard code it.
3. I had mentioned in my previous comment, apart from admin configuration nothing functions should be in admin.inc file make another file with .pages.inc like or use .module itself for front end functionality.
4. Validation issue is their error comes if i got the "You need to be 21 or over to access the site." then click on another link it does not validate again.
5. Add a condition if visitor is on home page.
This is fine you are using hook_url_inbound_alter(). No need to use hook_init().
Comment #9
BigEd commentedOk I have reworked a lot of the code fixing a lot of issues and added the new feature for selecting an age.
I am just cleaning up the last validation errors on http://ventral.org/pareview/httpgitdrupalorgsandboxbiged2007914git
From the latest version can anyone see anything that I may have missed?
Thanks guys.
Ed
Comment #10
BigEd commentedComment #11
ronfeathers commentedAwesome module, BigEd - I'll actually use something like this on a site I'm building for a brewery!
In you summary, you might change the git repo link to: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/biged/2007914.git instead of your username-prefixed URI
lines 52 && 53 in age_verication_pages.inc are commented out ... just remove them
// kpr($form_state['values']['urls']);
// exit;
When I do a fresh install, and navigate to the home page, I get the verification page - awesome. Forces me to be 21 to enter... but when I go to the config page (admin/config/development/age-verification) the default is set to 16? Kinda strange.
Also, on config page the description, your comment about allowing HTML looks broken. I think I see why you coded it like that, but it looks a little funny.
... Can have html in example href="/cookie-policy" target="_blank">Cookie Policy ...
While I mostly agree with the default ages you supply, are there others that should be included? Or at least allow me to add my own. For example, drinking age in Haiti is 16, 19 in some parts of Canada, 20 in Paraguay. (source: http://en.wikipedia.org/wiki/Legal_drinking_age).
Totally going to use this module, thank you!
~R~
Comment #12
manarth commentedI've had a look at the new version - I think there's a misunderstanding about how foo.admin.inc and foo.pages.inc should be used.
foo.admin.incshould generally be used for the page-callbacks and supporting functions for admin pages.foo.pages.incshould generally be used for the page-callbacks and supporting functions for pages and tools that are available to regular users.The admin callbacks were previously correctly found in
age_verification.admin.inc. Those callbacks should be moved back to that file.The /age-verification URL contains the callback
age_verification_form(). Thehook_menu()implementation specifies'file' => 'age_verification.pages.inc', but the callback is actually found in the .module file.In summary: you should:
- move the contents of 'age_verification.pages.inc' to 'age_verification.admin.inc'
- move the callbacks
age_verification_form(),age_verification_form_validate()andage_verification_form_submit()to 'age_verification.pages.inc'.- change the
hook_menu()implementation to reference the files accordingly.Comment #13
BigEd commentedHi guys, Thanks for taking the time to review.
@ronfeathers
Thanks I am glad you like it, I think there is some good additions that can still be made to this module and have some ideas I want to develop later.
The 21 age is set as the default, and the form isn't you are right this is confusing to the user. I will change this.
The HTML is something I thought I might come back to, I was kind of using as a quick way to test as I only needed to put the a link around it, of course if I do it becomes a link. There is probably a better way of explaining this with out the use of HTML.
The legal drinking age limit. You are correct it needs some variation I suppose I could add a field to let the user choose. I was thinking I might change this later, for a quick solution I will add more ages in. I guess the age gate may not be for just drinking but could be anything as an example it could be a gamers website that has a limit of 14.
@manarth
Thanks fella yea you are correct, I will amend this today. I suppose there is some guidelines relating to the file types that I could follow, I thought I had it correct originally but the changes went back and forth we came to a situation where it was slightly off. No problem I will try and re work this to your correct implementation of the pages today.
Comment #14
BigEd commentedThese changes were added.
Comment #15
chrisfree commentedBigEd,
I took some time today to review this module. Nice work and something I'll like need to reach for some day. Here are some things to consider:
Otherwise I didn't notice anything that jumped out at me. Module seems to work as intended.
Thanks,
Chris
Comment #16
manarth commentedReading Chris' comments above, I realised that the description is vulnerable to an XSS attack, mitigated by the fact the a user needs the
administer age_verificationto carry out the attack.You should either mark the permission as restricted:
Or escape the markup through filter_xss (or similar):
@Chris, I've not come across anything to suggest that
.gitignorefiles should not be present in contrib modules, do you remember where you came across this advice? IMO it's OK to use them - although in this case, I'm not sure how much value it adds.As for the
packageproperty in the .info file, I'd be happy to see it omitted. It's useful for grouping related modules (esi uses "Caching", so it's grouped with Varnish, Expire and similar modules), but "User Interface" may be a bit generic, I'm not sure that'd help with grouping. If a package property is omitted, the module simply uses "Other" which is a reasonable well-understood default.Comment #17
BigEd commentedGreat thanks guys,
All those changes are done I will be upload shortly.
@Chis I have left the GIT ignore I added this to ignore the .project file, otherwise I will end up playing GIT tennis.
As already mentioned I had a package file originally and manarth felt "Other" was ok. If you have any other thoughts on this let me know.
Comment #18
BigEd commentedThats changed
Comment #19
Anonymous (not verified) commentedThis is a great simple module BigEd. Seemed to work perfectly for me on a version 7.22 clean D7 install. This is small item but you could change the wording on the permissions page to be a little cleaner.
Current:
Administer age_verification
Configure Age Verification Warning: Give to trusted roles only; this permission has security implications.
Slightly cleaner:
Administer age verification
Warning: Give to trusted roles only; this permission has security implications.
Comment #20
Anonymous (not verified) commentedComment #21
manarth commentedThe text "Configure Age Verification" comes from the permission's description, the text "Warning: Give to trusted roles only; this permission has security implications." is from the
'restrict access' => TRUEflag.In this case, the title is enough to describe what the permission does, the description could be completely removed.
Comment #22
BigEd commentedThanks guys, that's done and committed.
Comment #23
ram4nd commented.gitignore file seems obsolete.
Codesniffer still finds some stuff http://ventral.org/pareview/httpgitdrupalorgsandboxbiged2007914git
Comment #24
BigEd commentedFixed the codesniffer issues.
.gitignore If i remove then I will play gitignore tennis with the .project file.
Comment #25
ram4nd commentedYou have to move the .project folder then, you can't have it because you need it, it's obsolete.
Comment #26
BigEd commentedOk yea you are right I agree.
Its done.
Comment #27
BigEd commentedAs this is taking a while I have since added a new feature that I have committed.
There is an new field in the the admin section to add user agents. There is a new section in .module under the
function age_verification_url_inbound_alter
This is tested and working fine. Please let me know if you can see any other issues.
Thanks,
Ed
Comment #28
kerasai commentedHi there, I've taken a look over the module and here's what I've found:
Nice job. This looks useful and should be available as a project.
Comment #29
kerasai commentedForgot to change status.
Comment #30
BigEd commentedThanks for reviewing kerasai I will look at these points when I am back from holiday.
Comment #31
ram4nd commentedComment #32
nicholas.alipaz commentedI would like to commend BigEd on the patience he has had in this issue. It is my opinion that his application should already be approved at this point. He is very attentive to the requests, fixing issues, and seems to be interested in further development.
However, as maintainer of the Validate Age module, I want to extend an offer to create a D7 version of this module rather than creating a new project.
Comment #33
BigEd commentedThanks nicholas I think there is a cross over here and we could join forces.
Can take time to look at each others code and propose a merge to benefit the community.
I would appreciate if I was given full project access in return for this effort.
Comment #34
nicholas.alipaz commentedYeah, I agree and I am truthfully okay with a complete divergence of the code for D7 assuming it is an improvement. Open an issue about this in the issue queue if you want to work out further details, or write me via my contact form. Best!
Comment #35
RavindraSingh commentedHi nicholas,
I think @BigEd should get the full access for projects. I see since long time he has been working on module. I also agree that there is existing module available for Age Verification. So I too request to you for @BigEd to get full access so he can develop and publish another modules easily.
I appreciate to BigEd for his efforts.
Thanks,
@Ravindra Singh
Comment #36
Anonymous (not verified) commentedKeen to see this module in its live state. Have just built an ecommerce site in drupal commerce and this is the missing link. Google wont allow us to advertise alcoholic products through adwords without this. Thank you for the code bashing so far and any collaborations in the future
Comment #37
BigEd commented@Ravindra Singh Thanks for the support fella.
@nicholas I will post a message to you and we can discuss a way forward.
@porker this module is in a working state while it is production you can let me know if you have any issues, but should work for you with out problem as long as you save the options on the admin page. When we have merged the module you can switch over to the new one.
Comment #38
Anonymous (not verified) commentedAny way I can have this without git?
Comment #39
BigEd commentedIt would be better to check it out from Git as you can get any updates easily.
However if you really need it message me and I can send you a one off version.
Comment #40
Anonymous (not verified) commentedHi Ed
Added some urls to ignore and now get redirection loop on all browsers for anonymous user. Tried removing them but problem wont go away.
Any thoughts?
Comment #41
Anonymous (not verified) commentedHave found that only using the relative URL's user and node and nothing else it works fine. In other words whatever URL I add on top of these causes a loop.
Comment #42
BigEd commentedI just replied to the email on this I think I know what the issue is.
Let me know if that helps if not ping me back I think I know what I can change.
Comment #43
ram4nd commentedWhy not use the module load that seems to work for everybody?
Comment #44
Anonymous (not verified) commentedHi there
Just following up my issue above. Still seeing infinite loop after adding relative urls. I have manged to access admin and remove the urls but despite doing so the loop still occurs when viewing site anonymously. Cannot see any reference to age verification in database.
Thank you
Cheers
Comment #45
BigEd commentedHi Porker,
I emailed you an updated version, let me know if you still have any issues.
Comment #46
PA robot commentedClosing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #47
BigEd commentedHappy New year all. Please review.
Comment #48
awasson commentedHappy New Year BigEd!
Hopefully these are minor issues. Everything works flawlessly but two items as far as I can see.
1) It seems that the math is slightly off. If I set it to 14 years and try to enter with a birthdate of Jan 1, 2000, I can't get in it tells me I must be 14 years old. Same for 16 years old and a birthdate of Jan 1, 1998. I am told I must have the corrects date of birth. I did check my Drupal settings and it shows that today is Thursday, January 9, 2014 - 06:11 (It's actually still Wednesday but I'll let the test site be out by a few hours.)
2) I am receiving a Theme Warning: Theme hook agil_list_form not found. I haven't got any idea what that is. The referrer appears to be: /age-verification?destination=node/xxx
Other than that it seems solid and easy to use. Awesome addition I'd say.
Tested on new vanilla D7 site with Bartik theme.
Cheers,
Andrew
Comment #49
perignon commentedJust a quicky. When you post Git links in the public. Make sure you post the public Git clone. In your issue here you have your D.O account git URL (biged@)
Use this one:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/biged/2007914.git age_verification
Comment #50
perignon commentedModule breaks drush.
I just discovered that with your module enabled, Drush terminates due to an "unrecoverable error". I confirmed this looking at the Drush debug log and tracing that core gets bootstrapped fully then crashes when moving to modules. Disabling your module makes the problem go away. I havent' looked at your code yet (about to) this is typically caused by a bug/problem in a hook_init() call.
Comment #51
perignon commentedFound the culprit. The drupal_goto is causing Drush to crash. Which is a typical reason for Drush to crash.
To fix this, add an additional condition to your IF statement on line 120. Add this as another check. This will not run the drupal_goto command if the caller is CLI (Drush).
&& php_sapi_name() != 'cli'So line 120 becomes
if (empty($GLOBALS['user']->uid) && empty($_SESSION['age_verified']) && $original_path != 'age-verification' && php_sapi_name() != 'cli') {Comment #52
perignon commented@awasson In regards to #1. The math is correct. They are using the DateTime PHP library to do the calculations which is good. http://de1.php.net/manual/en/book.datetime.php
I cannot replicate your #2.
I'm most interested in this module because I am building a website for a brewery :-D
Comment #53
perignon commentedNot a blocker to project status but the custom form submit handler in age_verification.admin.inc is not needed if you key your form array with the variable names you want them to be. Drupal will automatically save the variables as the key name when using the return system_settings_form().
For instance:
Should be:
Then you can deleted the custom submit handler and save a little code.
Comment #54
perignon commentedLast comment. I have modified your code with the changes to fix drush and the recommendation for the admin pages and verified that it works. I'm actually needing this module for a site I am building like previously stated.
If you can, at a minimum, commit the fix for Drush then I would gladly say this module is ready for nomination as a project.
Comment #55
awasson commented@Perignon: Yes I see that that code uses the Datetime library but are you able to properly verify ages? I can not.
If I were born Jan 1, 2000 then I would be 14 years old today. So if I enable the module on my site, set it to 14 years for the verification and upon entering the site tell it my birth date is Jan 1, 2000, I should be able to get in. I cannot. I have to tell it that I was born Jan 1, 1999 in order to gain access.
At first I thought maybe my server's date time was incorrect but glancing at recent logs I can see that my server's clock is slightly ahead of time but it still is set for 2014 (01/12/2014 - 21:57).
I will do a little looking into the #2 issue I noted and see if I can find the problem.
Andrew
Comment #56
awasson commentedOk.... Issue #2.
If I run the module in a vanilla D7 site and I check my recent logs, I see an error: Theme hook agil_list_form not found.
This looks to me to be caused by the age verification form or more precisely in age_verification.pages.inc the function:
I believe the issue is that theme_agil_list_form() hasn't been defined.
I don't have access to my test site so I can't check but I think something like this is what is needed (I'll try this in the morning):
Comment #57
awasson commentedOn further examination of issue #2, it looks like the line of code that is causing the php warning might be an erroneous piece of code in your module. I can't see where $form['#theme'] = 'agil_list_form'; makes sense in your module. I removed it and the warning goes away so maybe it was something that was left over from development. I've included a git patch if you decide to remove it. It just removed $form['#theme'] = 'agil_list_form'; from line 11.
The only thing left from my point of view other than the fix for drush from Perignon on comment #51 is that the math seems to be incorrect by one year. If that can be sorted out or we can figure out why it's out on my server then it's good to go.
Andrew
Comment #58
perignon commentedHrm. I just confirmed the age issue myself. I'm going to try other ages to see what happens.
Comment #59
perignon commentedI found the problem. I'm working a fix. It's resolving the current date to just the year and basing the calculation off of that. What we need to do here I think is use EPOCH time to do the calculation - break it down to seconds and it's easy to do the math.
Comment #60
perignon commentedRolled a patch against this to include all the changes.
Note that there are more changes than just the time calculation. I had already removed the submit handler and converted the admin page over to using Drupal's core functions for system settings forms. I also ran code styling/formatting over the files.
Comment #61
awasson commentedNice work Perignon. I ran that patch against my local copy and it's working perfectly!
BigEd, if you apply the patches from #57 & #60 it'll satisfy the concerns I had and I'll be happy to vote this module gets promoted.
By the way, check patch #57 and my comments first before applying it in case you did intend to use the statement: $form['#theme'] = 'agil_list_form';
Cheers,
Andrew
Comment #62
BigEd commentedWow great help guys, I will make the recommended changes asap.
Comment #63
BigEd commentedComment #64
awasson commentedThanks BigEd, I'm out of town at the moment but I'll see if I can get around to reviewing your changes in the next day or two.
Comment #65
BigEd commentedThanks for taking the time to review, both changes applied with credits.
@awasson, Yes thanks the theme link was not completed. Its a feature I was thinking of adding later, I didn't realise it was committed it's now removed.
Comment #66
awasson commentedLooks great BigEd.
Thanks for the effort.
I'm all for this module being promoted!
Comment #67
perignon commentedMe too. Lets get this promoted!
Comment #68
kscheirer$form_values['confirmation'] != 1, it's easier to make that form element#requiredwhen creating the form in age_verification_form().Otherwise l think this module is ready to go! There's no major issues listed above, but it would be nice to reduce the number of issues.
----
Top Shelf Modules - Crafted, Curated, Contributed.
Comment #69
perignon commentedSince I wrote this code:
"What are the key values in the age_verification_selected select list? Can you use an integer field instead, so the admin can set whatever age they like?"
This is where you pick your battles. Do you define it via a drop down or do you add more code to calculate the number of seconds based on the user input as well as validating the user input.
In this case I would let this go forward the way it is written and put the ability to put an arbitrary amount of time in the roadmap for future development of the module. Because this is asking the contributor/developer to do more work instead of fix problem with the existing code.
I fully would (and have) accepted the module with just a drop down. The #1 use of this module is for people 18 and 21 years of age.
I would agree that line 21 of age_verification.pages.inc needs changed to:
'#title' => t('I confirm that this is my age'),Comment #70
perignon commentedIn regards to:
"Instead of checking for $form_values['confirmation'] != 1, it's easier to make that form element #required when creating the form in age_verification_form()."
It is already required. Seems the code in the validation is a second check?
Comment #71
BigEd commented@kscheirer, Thanks for reviewing most of those are simple enough I can roll that into a quick update.
I will leave out the new feature field its not urgent and will look to change it later as in above comments, at the moment for the sake of getting this released I am avoiding any new feature changes and doing bug fixes only.
Thanks guys,
Comment #72
perignon commentedThis still not been promoted to a project yet?
Comment #73
BigEd commentedNo I don't have access to make a project yet.
I have made those changes so unless there is anything else I believe this to be ready.
Comment #74
awasson commentedWell, I guess we're in the wait part of the process. All the hoops appear to have been jumped through and according to the process we are here:
Once all issues have been addressed:
The reviewer will change the status of the issue to 'RTBC'
We've done that. The next step is:
A 'git administrator' will validate the review, grant the applicant the 'Create Full Projects' role, and change the status of the application to 'fixed'.
Comment #75
perignon commentedYeah I think we are at a loss of git admins..
Comment #76
ram4nd commentedYou have to get the review bonus, or it won't be looked upon.
Comment #77
BigEd commentedEven though this is done and has been for a while I thought it might have been given full project access. I haven't had time to look at anything else recently, but I will try and do some reviews this week to get this moving as I am aware that there are people waiting to use this module.
Comment #78
BigEd commentedComment #79
BigEd commentedComment #80
BigEd commentedComment #81
BigEd commentedComment #82
awasson commentedYup, doing some reviews will speed things up for sure. Once you've done a review or three, update this thread noting that you've done some reviews and they'll be pretty quick.
Comment #83
BigEd commentedYes done three now see above.
Comment #84
awasson commentedComment #85
klausiRemoving review bonus tag, you have not all manual reviews, you just copied the output of an automated review tool. Make sure to read through the source code of the other projects, as requested on the review bonus page.
Comment #86
BigEd commentedFair enough I was in the middle of doing that anyway, I will finish those off and repost.
Comment #87
BigEd commentedComment #88
awasson commentedHey BigEd,
Once you've done the manual reviews, update this issue and add the "PAReview: review bonus" tag so that the powers that be will be alerted of the status.
Cheers,
Andrew
Comment #89
ruslan piskarovHello, BigEd.
I think that will be very good to apply this patch.
Comment #90
m1n0 commentedAlso, there is a backslash before the php tag on the first line of the .module file, we definitely do not want a full project with such an obvious error.
Good job on the module though, will be handy in future.
I might have some feature requests which I need for a client, maybe some of them could be generally used. If so, I will post patches not dependent whether the module will be or will not be committed by then.
Comment #91
BigEd commentedComment #92
BigEd commented@m1n0 wow not sure how that was missed or where that came from must have been committed by accident a while back, thanks for the spot.
@Ruslan Piskarev ok I take your point for consistency maybe it would be cleaner to change the user agents, I went through and changed these and the other form related ones with in all the files, thanks.
Those are all added, one other thing I am just testing is a possible conflict with drush, once that's changed i will update this issue and add the "PAReview: review.
Comment #93
BigEd commentedComment #94
mpdonadioAutomated Review.
These are leading to warnings and notices:
This is a blocking issue.
Manual Review.
Module duplication/fragmentation is a problem on drupal.org. You need to elaborate on how this differs from other modules
and outline their differences, particularly with Legal. Put this in the description above, and on your project page.
You don't need to variable_set() in age_verification_install; use default values in your variable_get() calls.
I get warnings / notices:
age_verification_menu() should have a comment in it about why the age-verification page always needs to be accessible.
In age_verification_url_inbound_alter, use drupal_is_cli() instead of function_exists('drush_main')
age_verification_url_inbound_alter() shouldn't have explicit return values.
Use user_is_anonymous instead of empty($GLOBALS['user']->uid.
In age_verification_admin_form(), don't run HTML through t().
variable_get() should always have a default value.
Comment the magic numbers, like 662695992, to explain what they are.
Does the logic take into account leap lears properly?
In age_verification_form(), you don't need to do that with the default value on line 15.
Using the !age placeholder in age_verification_form_validate() is a a bad idea. What if things change with how you
store data? Use @age as a precaution.
If $form['age_verification_description'] is going to allow HTML, then don't use the paragraphs in age_verification_form(). Use
#prefix and #suffix to wrap it in a div w/ a class.
Your README should warn users that someone can set the user-agent and bypass the check.
The module description in the .info doesn't need to be quoted.
hook_inbound_url_alter may not be the best place for the meat of the logic. It gets invoked by drupal_get_normal_path(), so your check
will happen places other than at the beginning of a page reqeust. Really weird things may happen during search indexing when
cron.php is invoked from crontab. I really think this is a blocker (major API problem); it was mentioned early on in the
comments above, but I am not seeing an explanation as to why it has to be this hook.
Comment #95
BigEd commentedUpdated the missed the agent lines from previous commit, I should have tested further.
Legal does not have anything in common in with this module. Closet is the D6 version of Validate Age module but this works using cookies and is quite different, I have been added as a maintainer of that module and after this is released I may look at updating it but its a different module.
The magic numbers, like 662695992, those are seconds
html in t() yes I agree, changed.
!age replaced by @age, don't feel that sanitizing is needed for that variable.
There are many modules release that don't return default value for variable_get() I don't think this is an issue.
hook_inbound_url_alter was replaced after hook_init which has the caching issues, I think this is fine as is but if you have a better proposal please feel free to let me know.
The other items I think are fine.
Comment #96
mpdonadioI'm setting this back to needs review; the proper procedure is for others to set RBTC.
Of the things I mentioned, the duplication issue was the blocker. This is in the project application checklist (https://drupal.org/node/1587704), and is something that reviews are being explicitly asked to check for. Edit your info into the description above, so that it is available for final review.
If hook_boot() isn't suitable for all you need to do, that I won't use this as a blocker, but I think you need to test whether outside cron runs will still function (or you may need to add a test for cron.php, authorize.php, update.php, and xmlrpc.php in your logic). But make sure you document this.
I will likely review your changes tonight.
Two quick comments, though.
Even though many modules don't use the second parameter for variable_get(), it is best practice to use it.
With placeholders and which flavor to use, don't think of it as sanitization being needed or not. Think of it more as "I know I have HTML so I need this to go through unaltered and need !arg."
Comment #97
perignon commentedGuess I need to play catch up on this module. I am already using this (modified) on a production website. Being that I hacked it my code base has deviated of course. I honestly cannot believe this has been lingering now for almost a year.
Comment #98
perignon commentedThis module has been in the queue for one year and 3 days. Duplication of other modules has long been addressed.
Comment #99
nicholas.alipaz commentedI would like to quote myself again:
I also need to note my other comment:
In summary:
I am not really sure why this thread keeps going under review when you have everything you need BigEd. I am marking this thread as Needs work since we should agree on whether this module really subtantiates creation of a new project. I don't believe it does.
Comment #100
perignon commentedIn this case I totally agree with @nicholas.alipaz his statements here give free reign over the Validate Age module with no upgrade page, no rewriting code, and starting from a clean slate - go with it.
Comment #101
mpdonadio@Perignon, the project is over a year old, but it got a review bonus six days ago. Having prospective module maintainers review projects helps get everything reviewed faster, and also exposes new contributors to more code (both good and bad). Personally, I am working through the mentoring process to try to become a review administrator to help with the backlog of project applications. One of the things mentioned to me is the duplication/collaboration process. This is rather explicit in the project application checklist, and I have seen applications turned down as a result. It also needs to be part of the "application" which is the top description on this page. Having all of this in one place really does help admins. See also https://drupal.org/node/1187664
Comment #102
perignon commented@mpdonadio Correct that the duplication/collaboration process is very important. I have also put my $0.02 cents in on the entire application process (I started some of the flamethrowing threads on G.D.O). However the duplication issue was resolved because there was not a module for D7 that answered the question of age verification. Now recent information has come to light about the collaboration issue. The details of which we do not know but we have the maintainer of the D6 module saying "go for it" and that changes things.
Like I said before, I needed a capability like this for a upstart brewery website so I used this module but modified it for my own means. Prior use should have some factor in the application process!
Comment #103
BigEd commentedI have to say I am getting quite disillusioned in this process, if I had known a year ago what I would have to go through I wound not have bothered which is not ideal for the community.
Yes there was no D7 version of an Age gate module, yes I have offered to help with looking at the D6 version of validate age but upon looking at the code it currently works in a different way using cookies as one example. It has a lot of features that need to be thought about and decided if they are really needed. The reason why there is no Drupal 7 version of it is because of the huge job this would entail.
The module I wrote is light weight and I was about to release an 8x version of it but I was waiting till this awful process was complete.
Comment #104
nicholas.alipaz commentedI wrote this 9 months ago:
That means you have free reign to write a D7 branch that is exactly the code you have already written, without any upgrade path. Just do it, you could've done it months ago when I gave you access to the project.
Comment #105
BigEd commentedOk for my own sanity and not having this sitting in here for another year I am going to take your offer to resolve this now.
@Nicholas I have given it some thought, even though I think it will open up a can of worms for current users I will merge this on the condition of full project access. As soon as this is done I will login and create a 7.x version of the validateage module.
Comment #106
ankitgarg commentedHi BigEd,
One error still there "http://pareview.sh/pareview/httpgitdrupalorgsandboxbiged2007914git".
Comment #107
nicholas.alipaz commentedBigEd, maybe do this. Create your module as 7.x-2.x branch and edit the description of the project to say that 7.x-2.x is a complete rewrite and there will be no upgrade path. The 7.x-1.x branch would then be for a straight upgrade from 6.x if we ever tried, or someone provides one.
Comment #108
nicholas.alipaz commentedBigEd, you do have full project access. You have all permissions to the project except 'Administer maintainers' and have for quite some time.
Comment #109
BigEd commentedI meant permissions in here for ability to post other modules as full projects.
Comment #110
BigEd commentedI have been going through this for over a year according to the process, all I need is for a 'git administrator' to validate the review, grant the applicant the 'Create Full Projects' role, Than I can proceed.
Anyone like to comment?
Comment #111
klausiCould you rename and commit your code to the validateage repository?
I think we can proceed with reviewing and granting the git vetted user role after that trust has been established.
Comment #112
BigEd commentedOk thanks Klausi.
Comment #113
BigEd commented@Klausi the code is renamed and committed to validateage.
@nicholas.alipaz do you have any last thought on this?
Thanks,
Comment #114
BigEd commentedAnybody?
Comment #115
mpdonadioResetting status so one of the admins can take a look.
Comment #116
klausiReview of the 7.x-2.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
But that are not absolute critical application blockers, otherwise I think this is RTBC. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Assigning to mpdonadio as he might have time to take a final look at this.
Comment #117
mpdonadioUpdated git link to refer to the project and not the sandbox.
Comment #118
mpdonadioThat's what I get for not previewing...
Comment #119
mpdonadioAutomated Review
There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732
Review of the 7.x-2.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Not attaching the results, as they are the same as in #116.
Manual Review
It looks like many/most of my comments in #94 didn't get addressed.
I concur with klausi's comments in #116.
This module needs TLC for prime time, but there are no critical application blockers.
Comment #120
mpdonadioThanks for your contribution, BigEd!
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #121
BigEd commentedThanks guys much appreciated and I will take a look at those final items.
Comment #123
Staler75 commentedi really need this module with a little tweak, only the question are you over 18 and two buttons with yes or no (or something like that) love this concept and it works great but i want to over my visitors a one click agegate.
can somebody help me to tweak this module to do just that? i'm not really a code wizard ;)