Using an updated version of the code from issue 27633, I added referrer information to the contact form, but it doesn't work right.
The hidden field is correct on the page, but when I submit, the email says it was referred from '/contact', so I think the problem is with the form processing or validation. How do I fix this?
Details: Using Drupal 6 beta 1, Linux Server
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | contact_ref3.patch | 4.47 KB | bradlis7 |
| #5 | contact_ref2.patch | 4.45 KB | bradlis7 |
| contact_referrer.patch | 2.89 KB | bradlis7 |
Comments
Comment #1
bradlis7 commentedNot sure if this is a better status to have or not...
Comment #2
bradlis7 commentedI'll put it down for 7, because I don't think 6 is open for this feature.
Comment #3
BioALIEN commentedI would personally tag this for D6. What you're patching here looks security related as most contact forms return a referrer for an endless list of reasons.
It's a welcome enhancement to the contact.module and it gets my +1.
Comment #4
bradlis7 commentedIf you think so, I'll tag it so until someone says otherwise. Should this be bug report?
Comment #5
bradlis7 commentedWell, I've made a working patch, but I don't like the way I had to do it. It feels like too much of a hack, using session variables and such. If there's a form API guru out there, I could use your wisdom on this...
Comment #6
dries commentedCoding style needs work. Should also be postponed to Drupal 7 as Drupal 6 is feature frozen.
Comment #7
bradlis7 commentedTry this. If any more code cleanup is necessary, let me know.
Comment #8
robin monks commentedPlease make sure some sort of check_plain is run on the referrer, we don't want to pass uncleaned input.
Robin
Comment #9
dave reidInstead of writing the referrer to the session, it should be added as a FAPI element:
I think this also needs more discussion and since it's a feature request, it's not likely to be accepted for D7. Bumping to D8.
Comment #10
deekayen commentedIn the many years since this issue was created, the mail_alter hook was introduced. I can picture altering various things through a contrib module to add a form value containing the referrer and then altering that into the mail, either as a body concatenation or a new X- header.