Add the option for a form to use the submitter username and email address as the from address.
rmiddle - January 3, 2009 - 04:29
| Project: | Webform |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
I needed this for a project. Before I port it to Drupal 6 I need to know if this is going to be accepted.
Thanks
Robert
| Attachment | Size |
|---|---|
| d5_webform.patch | 6.37 KB |

#1
#2
Ooo, interesting. If I understand correctly, this patch make the username and e-mail address the "from address"? I'm not sure where passwords come into play.
This looks like a good approach, but it's worth mentioning that you can do this anyway with two hidden fields with the default values of %username and %usermail, then use those component as the From name and e-mail. Regardless, this might be a nice shortcut. What happens when the user is not logged in?
#3
quicksketch,
The title made since when I wrote it? I ment email address not password.
%usermail doesn't work because the validation function doesn't allow it. We could update the Validation function to allow support for that variable but it would still be a lot harder for a user to find. I think I did try using %username at one point but it didn't work although I am pretty certain that was a typo on my part not something that doesn't work as it works when I tried it after create this patch.
When the user isn't logged in or in the off change there is no email address defined. I my case it happens sometimes because someones AD account doesn't have one set. Then it will fall back to webform's system wide defaults.
Thanks
Robert
PS. I noticed I left 1 line of debuging code in there. If you think the idea has merit I will update the 5.x patch when I submit a 6.x patch.
#4
Yep, I think this would be a good enhancement. If you can tidy up the enhancement and port it to 6 I'd be happy to commit it.
#5
Here is the lastest D5 & D6 patch against CVS.
#6
This patch has been used on my live site for over a month now with no visible problems.
#7
Bumping to the top of the list to see if quicksketch will have a change to add the update.
Thanks
Robert
#8
Thanks rmiddle, this code all looks fine to me. Sorry I've been completely swamped trying to get stable versions of FileField and ImageField released. Next time I'm working on Webform patches I'll add this in.
#9
There is one small bug inside a translatable string.
t('Use submitter\'s information if anonymous users use default.')need to be changed tot("Use submitter's information if anonymous users use default.")