What variables, besides %message and %body, can be placed in Email Template settings? Is there a way the subject of the email defaults to the title of the node being sent? Otherwise, is there a way to make the subject editable by sender?

Comments

dtabach’s picture

Is there a way the subject of the email defaults to the title of the node being sent?

A little hack did the trick.

In the send.module, change lines 184 and 188 (they are equal) from

<?php return t('@name from '.variable_get('site_name','Drupal'),array('@name'=>$nodename)); ?>

to

<?php return t($node->title); ?>

The only problem is that, if someone creates a node, save it and then go back to edit it changing its title, the subject of the email being sent will remain the older one. You'll have to go to 'Send to Friend' section in the Edit page and remove the 'E-mail subject line', then the email's subject is updated.

I'd appreciate any hints on avoiding this problem or improving the code (I'm not a PHP programmer).

dtabach’s picture

Removing the default subject in send.inc prevents the problem

Around line 25, change:
'#default_value' => _send_value('subject', $module, $nodetype, $node),

to:
'#default_value' => t(""), //remove default subject

These are my first experiments on hacking a module. I've never studied PHP, I'm learning things from trial and error. Any advices would be appreciated.

jerdavis’s picture

Status: Active » Closed (fixed)

Consolidating discussion of templating values here: http://drupal.org/node/210739

If you'd like to provide a patch to add additional values or change behavior, please post it there.

Thanks!

gohel raj’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev