Better info in information collection email

Author Message

Harry Oosterveen

Friday 05 March 2004 7:43:32 am

If information is submitted via an information collection object, and received by e-mail, the sender and subject of the email messages show default values. It is easy to adapt this, so the sender and subject are shown with the values filled in in the form.

To do so, you have to change the design/templates/content/collectedinfomail/form.tpl file to set the template variables
(assuming you have the 'subject', 'name' and 'email' as identifiers in the class definition):

{section name=Attribute loop=$collection.attributes}
{$Attribute:item.contentclass_attribute_name|wash}:
{* Add these lines *}
{switch match=$Attribute:item.contentclass_attribute.identifier}
{case match='subject'}{set-block scope=root variable=subject}{concat($collection.object.name,': ',$Attribute:item.data_text)}{/set-block}{/case}
{case match='name'}{set-block scope=root variable=name_sender}{$Attribute:item.data_text}{/set-block}{/case}
{case match='email'}{set-block scope=root variable=email_sender}{$Attribute:item.data_text}{/set-block}{/case}
{case}{/case}
{/switch}
{* End of addition *}
{attribute_result_gui view=info attribute=$Attribute:item}

Next step is to change the file kernel/content/collectinformation.php:

// Around line 272
$subject =& $tpl->variable( 'subject' );
$receiver =& $tpl->variable( 'email_receiver' );
$redirectToNodeID =& $tpl->variable( 'redirect_to_node_id' );
// Add these lines
$name_receiver = & $tpl->variable( 'receiver' );
$name_sender = & $tpl->variable( 'name_sender' );
$email_sender = & $tpl->variable( 'email_sender' );

...
// Around line 295
$mail->setReceiver( $receiver );
$mail->setSubject( $subject );
$mail->setBody( $templateResult );
// Add this line
$mail->setSender( $email_sender, $name_sender );

This should work fine, but the solution is not nice, as a file in the kernel has tobe changed. So, my question is: How can this be accomplished without changing this kernel file (create extension?)

Daniela Moreno

Wednesday 10 November 2004 10:08:01 am

So, i have no idea how can u do this without changing the kernel.
But it works great, solved lots of my problems.

Anyways, u were such a great help

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:07:27
Script start
Timing: Jan 18 2025 19:07:27
Module start 'layout'
Timing: Jan 18 2025 19:07:27
Module start 'content'
Timing: Jan 18 2025 19:07:28
Module end 'content'
Timing: Jan 18 2025 19:07:28
Script end

Main resources:

Total runtime1.0322 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 588.0469152.6406
Module start 'layout' 0.00590.0033 740.687539.4766
Module start 'content' 0.00921.0215 780.1641510.9219
Module end 'content' 1.03070.0015 1,291.085912.4375
Script end 1.0322  1,303.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3071160.0002
Check MTime0.00130.1258160.0001
Mysql Total
Database connection0.00100.098210.0010
Mysqli_queries0.981095.0360540.0182
Looping result0.00060.0565520.0000
Template Total0.999696.820.4998
Template load0.00180.170220.0009
Template processing0.997896.669920.4989
Template load and register function0.00010.011210.0001
states
state_id_array0.00100.092710.0010
state_identifier_array0.00370.358220.0018
Override
Cache load0.00170.1624400.0000
Sytem overhead
Fetch class attribute can translate value0.00100.101420.0005
Fetch class attribute name0.00180.170740.0004
XML
Image XML parsing0.00250.246720.0013
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00270.2582210.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs