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

AttachmentSize
d5_webform.patch6.37 KB

#1

rmiddle - January 3, 2009 - 04:29
Title:Add the option for a form to use the submitter username and password.» Add the option for a form to use the submitter username and password as the from address.

#2

quicksketch - January 6, 2009 - 05:27

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

rmiddle - January 7, 2009 - 15:43
Title:Add the option for a form to use the submitter username and password as the from address.» Add the option for a form to use the submitter username and email address as the from address.

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

quicksketch - January 9, 2009 - 08:37

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

rmiddle - February 20, 2009 - 04:47

Here is the lastest D5 & D6 patch against CVS.

AttachmentSize
d5_webform.patch 6.13 KB
d6_webform.patch 5.84 KB

#6

rmiddle - February 20, 2009 - 04:48

This patch has been used on my live site for over a month now with no visible problems.

#7

rmiddle - March 29, 2009 - 23:36

Bumping to the top of the list to see if quicksketch will have a change to add the update.

Thanks
Robert

#8

quicksketch - March 30, 2009 - 02:15
Status:needs review» reviewed & tested by the community

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

hass - April 10, 2009 - 12:44
Status:reviewed & tested by the community» needs work

There is one small bug inside a translatable string. t('Use submitter\'s information if anonymous users use default.') need to be changed to t("Use submitter's information if anonymous users use default.")

 
 

Drupal is a registered trademark of Dries Buytaert.