Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Some modules, for example Forward or Webform, are using a generated form_id that includes something highly variables (eg. NID). If we want the CAPTCHA to be applied on these forms we need to do it manually or we need to create one captcha_point for each node.
Proposed resolution
Try to load the captcha_point based on the base_form_id if there is none (or none active) for the form_id.
Remaining tasks
Patch, Review, Commit
User interface changes
Maybe an addition in the captcha_point creation/edition form to tell the user they can use the base_form_id.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#8 | captcha-use_base_form_id-2839891-8.patch | 1.67 KB | Prashant.c |
| |||
#4 | interdiff.2839891.2.4.txt | 1.28 KB | DuaelFr |
#4 | captcha-use_base_form_id-2839891-4.patch | 1.68 KB | DuaelFr |
| |||
#2 | captcha-use_base_form_id-2839891-2.patch | 1.29 KB | DuaelFr |
Comments
Comment #2
DuaelFrComment #4
DuaelFrOk! I thought all forms had that method.
Fixed!
Comment #5
zrpnrI like this solution, it worked on my webform that had an id like "webform_submission_contact_node_1234_form"
It was difficult to find the base form id, for webform it is "webform_submission_form"
Once I found that I created a new captcha point with that id and the captcha appeared.
Comment #6
jzavrl CreditAttribution: jzavrl at NDP commentedThe patch looks good and can confirm it also works well.
The way Webform generates form_id, I think this is a much needed functionality in the module.
Thanks!
Comment #7
elachlan CreditAttribution: elachlan commentedThere seems to be a merge conflict. Can you re-roll the patch?
Comment #8
Prashant.cPatch re-rolled.
Comment #10
elachlan CreditAttribution: elachlan commentedThanks!
Comment #12
mkrizaj CreditAttribution: mkrizaj commentedHi guys.
It looks like this is not working anymore. I've found this change record which says that webform base form id includes the webform id in newer versions. (https://www.drupal.org/node/2959264)
I've debugged the captcha module and noticed what was changed.
My case example:
I think we need to find a way to apply Captcha to all web forms instead of adding Captcha point for each webform separately.