Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Emailing Members


Go to End


6 Posts   1244 Views

Avatar
oerm4411

Community Member, 14 Posts

16 May 2011 at 9:50am

I have Willr's UserForms installed on my site. I would like to create a form to allow members to email themselves. I thought that the 'Member Field' would allow users to select the member they wish to contact. Unfortunately, that field doesn't provide an email address for the form to send the message. Would it be possible to create such a form?

Avatar
Willr

Forum Moderator, 5523 Posts

16 May 2011 at 4:14pm

You could create your own field type for that pretty easily. If you have a look at EditableMemberListField it does pretty much what you want but rather than returning the name from getValueFromData() you would want to return the email address.

Sending the email is a little tricker, you could adapt the Userform Email Recipient popup to allow you to select an EditableMemberList field as the 'Send To' option.

Avatar
oerm4411

Community Member, 14 Posts

16 May 2011 at 6:31pm

How would I create a field for this? In the list of fields, there is a Member List Field, but no EditableMemberListField.

Once the field is created, I think I could add it to the "send to" email field on my own.

Avatar
Willr

Forum Moderator, 5523 Posts

16 May 2011 at 6:39pm

How would I create a field for this? In the list of fields, there is a Member List Field, but no EditableMemberListField.

The editable member list field is the class name of the field. You can see the class in userforms/code/editor/. The module will automatically pick up any subclasses of 'EditableFormField' and display it in the editor.

In your cause you could extend the EditableMemberListField class with your own class and override the getValueFromData() method to return the email.

Avatar
oerm4411

Community Member, 14 Posts

17 May 2011 at 2:14am

Edited: 17/05/2011 6:25am

Okay, I see the file you are talking about, but the rest of the process is a complete mystery to me. I see a bunch of code in the file, but I don't have a clue on how to change that code for my needs.

Forgive my ignorance please. Perhaps someone can provide the code I need so I can just cut-and-paste? Or perhaps just creating a new file for me to use? I don't want to be a pain, but I don't want to screw up the utility by modifying the file incorrectly.

ETA: If possible, I would also like the 'From' field to automatically select the current user who is sending the message.

Avatar
Willr

Forum Moderator, 5523 Posts

17 May 2011 at 4:13pm

Ah yes, sorry my instructions were designed for more of a developer. If no one responds you may want to post this as a small job to oDesk or similar to commission a developer to get it working to your needs.