Last updated August 17, 2008. Created by jbrauer on August 6, 2008.
Edited by jerdavis. Log in to edit this page.
- go to your theme folder
- add the following function to your template.php
<?php
/*Templating for Send Module*/
function YOURTHEME_send_body($values) {
# send module can email multiple nodes, but my implementation sends only one..
# so this hopefully not break anything, node_load function will grab all other details for the
# node that the user is emailing
$node_details = node_load($values['nids']['0']);
## Adding my site banner
$body = '<hr /><img src="http://example.com/logo.gif" /><br />';
## adding node title
$body .= '<h2><a href="http://example.com/'.$node_details->path.'">'.$node_details->title.'</a></h2><br/>';
## adding full body, you might change this to only teaser
$body .= $node_details->body;
$template .= $values['template'];
if ($values['message']) {
$message = '<div class="messages">'.check_markup($values['message']).'</div>';
}
$replace = array('%message', '%body');
$values = array($message, $body);
return str_replace($replace, $values, $template);
}
?> - For testing, I used the following code. Its helpful when you have complicated CCK fields and want to debug your code. If you use gmail , use the "show original text" to see the actual values of the array.
<?php
/*Templating for Send Module*/
function YOURTHEME_send_body($values) {
$node_details = node_load($values['nids']['0']);
## just dump everything into email body
$body = print_r($node_details,TRUE);
$template .= $values['template'];
if ($values['message']) {
$message = '<div class="messages">'.check_markup($values['message']).'</div>';
}
$replace = array('%message', '%body');
$values = array($message, $body);
return str_replace($replace, $values, $template);
}
?>