• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Modifying user email based on options selected

Modifying user email based on options selected 13 years 2 months ago #12890

So I've searched these forums up and down for an example, but I haven't found one; hopefully my question isn't redundant!

I'd like to modify the email a user receives based on one of the options they can select. There are a lot of potential uses in this, but at its most basic I might want them to see a value (for example, a hyperlink) based on having made a choice, whereas what gets entered into the database is a simple yes or no.

It seems like this should be eminently doable using the field available to modify the $userEmail array, but for the life of me I can't figure out how. I've messed around with str_replace to zero effect.

To recap:

Right now, a user can select 'receive digital copy' or 'receive printed copy'. If they select 'receive digital copy', the value is set to 'PDF' which is what gets entered into the database (which is being exported into an access database). I'd like to swap out the generated value with a hyperlink that the user can click on and download the brochure.

Any help would be greatly appreciated!
The administrator has disabled public write access.

Re:Modifying user email based on options selected 13 years 2 months ago #12897

Hi Billing52:

My favourite trick for this sort of thing is the old hidden field.

Let's say you create a hidden field called "MyLink" with no initial value. Then include some JavaScript associated with the fields that determine whether or not the user is getting that link. Basically, the JavaScript says that if the conditions are met, set "MyLink" to the text and link you want to send (e.g., "You can view your digital copy here" with the appropriate link coded into it). If the conditions are not met, then set the value to blank.

In the e-mail, simply put {MyLink:value} where-ever you want the link to appear. If the conditions were met, the "MyField" hidden field will have the value of the link and appear in your e-mail. If the conditions were not met, the value will be blank and nothing will appear in that spot in the e-mail.

CM
The administrator has disabled public write access.

Re:Modifying user email based on options selected 13 years 1 month ago #12900

Hi CM!

Thanks for the answer, much appreciated. I wondered if that might be possible as well - my problem is a rather pathetic lack of familiarity with JavaScript. Still, excellent advice, and I'll poke around the forums to see if there are any example JavaScripts I can suss knowledge out of.

It seems like the$userEmail array isn't used much, is it?
The administrator has disabled public write access.

Re:Modifying user email based on options selected 13 years 1 month ago #12902

  • tim2
  • tim2's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 23
Hi billing52,
I posted an example here - www.rsjoomla.com/customer-support/forum/...m-email-routing.html.
Please let me know if you need further assistance.
The administrator has disabled public write access.

Re:Modifying user email based on options selected 13 years 1 month ago #12903

Hi Tim,

Thanks for the kind response. Looking over the script, it makes sense to me, and I've implemented it in the following way:

I have a checkbox field name 'FormatSelection'. It has two checkboxes:
pdf copy|Digital Copy
hard copy|Printed Copy

In the 'additional attributes' it says:

onChange=setDownloadLink();

Then, I have a hidden field named 'DownloadLink'. It has no default value.

Under 'CSS/Javascript' I've got the following code:
<script type="text/javascript"> 
 
function setDownloadLink() 
{ 
if(document.forms[0].FormatSelection.options[document.forms[0].FormatSelection.selectedIndex].value=="pdf copy")  
{ 
document.getElementById('DownloadLink').value = '<a href="http://www.mysite.com/document.pdf">Click here to download visitors guide in PDF form.</a>'; 
return true; 
} 
} 
</script>

No matter what I select for value (and I've also tried it as a drop down menu) the user email (which has {DownloadLink:value} in its body) stays blank.

If anyone can point out something I'm doing wrong, I'd be eternally grateful! Regardless, thanks for the help provided so far.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!