Forums

Automatic insertion of article in email reply?

faraon 18 Jul, 2012
Hi,

I may have not searched the forum with the right keywords, but here is my need:

- Since I do not want clients to mess up with the settings of chronoforms, I would need to pull automatic articles content to fill the email.

As an example, users register to view specific PDFs in the website but the links are not directly accessible (in order to get leads). They receive the link directly after registering through CF4 at teh valid email address given.

I would need the custom email message with direct links to be updated easily by client outside the CF interface (hidden to non-superadmin, J2.5).

Any easy way?

Thanks for your help.
GreyHead 19 Jul, 2012
Hi faraon,

I haven't tried this with CFv4 but it worked for a client in CFv3.

Create the HTML body for the email in an external file (or in an article if you prefer). Then use PHP to include it into the Email template by adding this code into the template:
<?php
include('path_to_file.html');
?>

Or to include an article:
<?php
$db =& JFactory::getDBO();
$query = "
    SELECT CONCAT(`introtext`, `fulltext`)
        FROM `#__content`
        WHERE `id` = '999' ;
";
$db->setQuery($query);
echo $db->loadResult();
?>
Not tested and may well need debugging!

Bob
faraon 20 Jul, 2012
Thanks, looks like the right direction logic, but I probably missed a step here, how can you add php code in your editor that only supports html and comments out automatically invalid html?

Here is what happens (at the bottom):

<p>{gender} {first_name} {last_name}<br />{company} ({country})<br />{email} <br />T. {phone}</p>
<p>Current website: {website}</p>
<p>Your request / project details:<br />{message}</p>
<p>Project Type: {project_type}</p>
<p>Timeframe: {timeframe}</p>
<p>ATTACHED FILE: {project_file}</p>
<!--?php 
include('index.php?option=com_content&Itemid=53&catid=50&id=6677&lang=en&view=article');
?-->
GreyHead 20 Jul, 2012
Hi faraon,

Turn off the Rich Text editor to use PHP in the Email template.

Or you could use a Custom Code action to add the included content to $form->data['inserted_code'] and then add that to the template as {inserted_code}

Bob
faraon 20 Jul, 2012
Where can I change the editor?
Not in the Joomla default config, I tried, looks like yours is another one.
GreyHead 20 Jul, 2012
Hi faraon,

It's off by default but you can change it with the link shown in the image.

Bob
faraon 20 Jul, 2012
Yep, looks great and easy to find, except that it is unfortunately not what I see here...
[attachment=0]ScreenShot1146.jpg[/attachment]
GreyHead 20 Jul, 2012
Hi faraon,

Please go to the form General tab (click the form name link to get there) and change the Form Wizard Mode to Advanced.

Bob

PS Don't change back again from Advanced to Easy or you may lose some settings.
faraon 21 Jul, 2012
Ok, managed, but now the after-submit page displays weird code.
Email received but without the additional content.
GreyHead 21 Jul, 2012
Hi faraon,

What weird code exactly?

Bob
GreyHead 21 Jul, 2012
Hi faraon,

I only see the normal debugger output - nothing weird there.

Bob
faraon 21 Jul, 2012
Why is there a debugger when the only thing i did was to include the php line above? I did not activate it...
GreyHead 21 Jul, 2012
Hi faraon,

Pass, I can't tell from here. Is there a Debugger action in your form On Submit event?

Bob
faraon 21 Jul, 2012
I just did what you said, switch to advanced, then pasted the p line, that is all.
GreyHead 21 Jul, 2012
Hi faraon,

Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
This topic is locked and no more replies can be posted.