CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Change Subject on Event Registration email
Pages: [1]

Author Topic: Change Subject on Event Registration email  (Read 1429 times)

ryanpitt

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 0
Change Subject on Event Registration email
July 24, 2009, 11:20:36 am
Hi All,
We have people signing up for an "event" via a standalone form from a CiviCRM Profile. The users who fill out the form are being added to a "holding" group where they will be re-grouped and dealt with accordingly. one of the steps that we would like to take is add these registrants to a specific event. When we do so, we are able to send out a confirmation email to those we are adding and it gives us the option to add the email body text. But we cant seem to find where we can change the subject of the resulting email which is currently "Event Confirmation".
We are using CiviCRM 2.2.7
Any clues would be greatly appreciated.
Thanks
Ryan

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Change Subject on Event Registration email
July 24, 2009, 12:37:29 pm
Ryan - I did some snooping on this, and it's a bit obscure as to how the "offline event registration" email subject is currently set....

The text "Event Confirmation" is hard-coded in this file on line 1117:
CRM/Event/Form/Participant.php

... and then it's passed to this template for output (which is also used for offline contribution and membership signup receipting :-( ):
templates/CRM/Contribute/Form/ReceiptSubjectOffline.tpl

Going forward (for 3.0 release due this fall), I'm going to modify the code so that offline participant registration uses it's own "subject template" - which will make it easier to customize.

For now, if you just need to change the text globally - I would create a custom copy of that template file - and add some conditional logic to it so it looks like this:

Code: [Select]
{strip}
{if $subject EQ 'Event Confirmation'}
Put Your Subject Here
{else}
{$subject}
{/if}
{/strip}

Do run a test with both offline contribution receipting and your offline event registration to make sure things are working as desired.
Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Change Subject on Event Registration email
July 24, 2009, 06:43:24 pm
Hi Dave,

Can you consider while you are doing this how hard it would be to enable html e-mails to be sent instead of plain text? (I assume a separate smarty template for html e-mails
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Change Subject on Event Registration email
July 25, 2009, 06:21:02 pm
Sorry - much bigger fish to fry. Will have to wait for future release.
Protect your investment in CiviCRM by  becoming a Member!

ryanpitt

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 0
Re: Change Subject on Event Registration email
July 27, 2009, 07:21:43 am
Dave,
Thank you for your response on this. I was able to find the code and I changed it right in that file for now.
Another issue popped up though. It seems that when the email in question is sent out, the sender address is a random selection from the database. Can you confirm this? Is there a similar way to hard code this also?
Thanks
Ryan

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Change Subject on Event Registration email
July 27, 2009, 10:58:51 am
Ryan - the FROM email address is set from the primary email address of the logged in user who is doing the offline registration. If this doesn't meet your requirements, you'll need to change line 1023 in CRM/Event/Form/Participant.php :

 $receiptFrom = '"' . $userName . '" <' . $userEmail . '>';

If you haven't read the wiki page on creating and using custom paths / custom copies of tpl and php files - I'd recommend it:
http://wiki.civicrm.org/confluence/display/CRMDOC/Customize+Built-in%2C+Profile%2C+Contribution+and+Event+Registration+Screens

Not covered in the above doc, but you can (and probably should) create a custom path for customized PHP files as well.
Set the path in Admin CiviCRM >> Global Settings >> Directories ... Custom PHP Path Directory
Protect your investment in CiviCRM by  becoming a Member!

ryanpitt

  • I post occasionally
  • **
  • Posts: 42
  • Karma: 0
Re: Change Subject on Event Registration email
July 28, 2009, 05:07:03 am
Dave, thanks for the reply.
I have changed that line but it doesn't appear to be working. Can you check my syntax?

 $receiptFrom = '"' . $userName . '" <' . $userEmail . '>';
Changed to
 $receiptFrom = '"'Ryan Pitt'" <'ryan@emaildomain.net'>';

Emails are still going out from the currently logged in user and at one time from a random address which was quite odd.

Thanks again,
Ryan

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Change Subject on Event Registration email
July 28, 2009, 05:59:21 am
ryanpitt :

Quote
Can you check my syntax?

 $receiptFrom = '"' . $userName . '" <' . $userEmail . '>';
Changed to
 $receiptFrom = '"'Ryan Pitt'" <'ryan@emaildomain.net'>';

You might want to change it to
Code: [Select]
$receiptFrom = '"Ryan Pitt" <ryan@emaildomain.net>';
or overwrite $userName, $userEmail and comment out the calls
Code: [Select]
//$userID  = $session->get( 'userID' );
 //list( $userName, $userEmail ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $userID );

$userName = 'Ryan Pitt';
$userEmail = 'ryan@emaildomain.net';
$receiptFrom = '"' . $userName . '" <' . $userEmail . '>';


HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Change Subject on Event Registration email

This forum was archived on 2017-11-26.