Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: [Solved]: Where are notification e-mails bodies located?  (Read 8609 times)

0 Members and 1 Guest are viewing this topic.

flyegye

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
[Solved]: Where are notification e-mails bodies located?
« on: March 23, 2010, 03:20:50 am »

Hi, I'm trying to change the content of the e-mail messages that Coppermine sends out but I can't seem to find. Does anyone know where it's located?

Thanks
« Last Edit: March 29, 2010, 07:42:43 am by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Where are notification e-mails bodies located?
« Reply #1 on: March 23, 2010, 07:13:17 am »

Depends on the type of email you mean: the ecard has a template of it's own as well as the report mail. Some emails get sent without without a template - you can however edit the design by editing the corresponding section in the language file. Do as suggested per board rules for a start and post a link to your gallery. Additionally, specify what email message exactly you want to see changed in which way.
Logged

flyegye

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Where are notification e-mails bodies located?
« Reply #2 on: March 24, 2010, 01:01:58 am »

Thanks for responding.

I was hoping to modify the look of the e-mail notification that is sent when a user is created. The e-mail tells them the login info.

I also would like to modify the look and feel of the e-card e-mail also.

I just can't seem to find those e-mail templates.

Thanks

Oh, here's the link to my gallery:
http://proofing.usedbatteriesphotography.com/
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Where are notification e-mails bodies located?
« Reply #3 on: March 24, 2010, 07:51:26 am »

OK, I understand now what you want to accomplish. I could come up with simple instructions, but I decided to explain how to find such things, not only for your benefit, but for the benefit of others with similar issues as well.
Here's what you do: you first search the language file for the string that is used in your template, i.e. you open lang/english.php with a plain text editor (notepad.exe is fine) and find the string. In your case (for the email that is sent to new users) that's
Code: [Select]
$lang_register_php['confirm_email'] = <<< EOT

Thank you for registering at {SITE_NAME}



In order to activate your account with username "{USER_NAME}", you need to click on the link below or copy and paste it in your web browser.

<a href="{ACT_LINK}">{ACT_LINK}</a>



Regards,



The management of {SITE_NAME}



EOT;
The entire language file consists of variables that are assigned a value (text strings). Usually, this happens like this:
Code: [Select]
$variable_name = 'Content of the variable';, but for strings that last over several lines (which is the case here), the so-called heredoc syntax is being used. This being said, this is the first place where you can change that string as far as the text is concerned. Leave the placeholders intact (the stuff in curly braces), they will be replaced with the actual content when the script is run.
The next stage is to take a look where in the code the variable ($lang_register_php['confirm_email'] in our case) is being used, so we perform a search on operating system level over the code files of your local copy of Coppermine. The search should only return one result: the file register.php. This means that there is no template that you could modify, but only the core Coppermine file that you could edit, but you will have to re-apply that hack each time you update your gallery. If you decide that this is fine, open the file with your plain text editor and find where the variable is being used: that's the line
Code: [Select]
            if (!cpg_mail($email, sprintf($lang_register_php['confirm_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_php['confirm_email'], $template_vars)))) {in your case, which can not be changed easily (if you know your way around you could change that section to send both an HTML-mail as well as a plain text mail, but that's a rather painfull job), so let's get back to our language file (lang/english.php) and edit that. Keep in mind that you will have to re-apply that edit whenever you upgrade your gallery, so you better take a note of what you do. As the string is later being sent through the function nl2br (which converts line breaks to the HTML tag <br />, you mustn't use that tag. In fact there are a lot of other things that you should not do (that include the usage of images inside emails). Most important of all things: after saving your changes, test them throughly on various platforms: open the emails generated both in web browser driven webmail clients as well as the major email clients Outlook, Outlook Express, Microsoft Mail, Thunderbird etc.

Now, let's go on: you want to change the look of your ecards as well, so you search your language file for that as well: edit lang/english.php with your plain text editor and find View more pictures!. You will find the line
Code: [Select]
$lang_ecard_php['view_more_pics'] = 'View more pictures!';. Take a look at the file ecard.php that the comment at the top of the definition refers to and you'll find a line in that file that reads
Code: [Select]
        '{VIEW_MORE_LNK}'  => $lang_ecard_php['view_more_pics'],and doesn't mean much for a newbie, but right beneath it you will find that in the code there is a reference to a template: the line
Code: [Select]
    $eccontent = template_eval($template_ecard, $params);is the hint that we needed.
Now the rest is dead easy: edit themes/yourtheme/theme.php with your plain text editor and find $template_ecard. If that variable definition resides in your custom theme, edit it as suggested below. But the chances are high that you won't find that in your custom theme, so you have to edit themes/sample/theme.php, find the string we're searching for and copy the entire section
Code: [Select]
/******************************************************************************
** Section <<<$template_ecard>>> - START
******************************************************************************/
// HTML template for e-cards
$template_ecard = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="{LANG_DIR}">
<head>
<meta http-equiv="content-type" content="text/html; charset={CHARSET}" />
<title>{TITLE}</title>
</head>
<body bgcolor="#FFFFFF" text="#0F5475" link="#0F5475" vlink="#0F5475" alink="#0F5475">
<br />
<p align="center"><a href="{VIEW_ECARD_TGT}">{VIEW_ECARD_LNK}</a></p>
<table border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td bgcolor="#000000">
      <table border="0" cellspacing="0" cellpadding="10" bgcolor="#ffffff">
        <tr>
          <td valign="top">
           <a href="{VIEW_MORE_TGT}displayimage.php?pid={PID}">{PIC_MARKUP}</a>
                                         <br />
                                         <div align="center">
                                                 <h2>{PIC_TITLE}</h2>
                                         </div>

          </td>
          <td valign="top" width="300">
            <div align="right"><img src="{URL_PREFIX}images/stamp.gif" border="0" alt="" /></div>
            <br />
            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:2.0em;font-weight:bold;">{GREETINGS}</span>
            <br />
            <br />
            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;font-weight:bold;">{MESSAGE}</span>
            <br />
            <br />
            <span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-size:1.6em;font-weight:bold;">{SENDER_NAME}</span>
            (<a href="mailto:{SENDER_EMAIL}"><span style="font-family:Arial,Verdana,Helvetica,sans-serif;color:#000000;font-weight:bold;">{SENDER_EMAIL}</span></a>)
          </td>
        </tr>
                <tr>
                        <td colspan="2">
                                {PIC_CAPTION}
                        </td>
                </tr>
      </table>
    </td>
  </tr>
</table>
<p align="center"><a href="{VIEW_MORE_TGT}">{VIEW_MORE_LNK}</a></p>
</body>
</html>
EOT;
/******************************************************************************
** Section <<<$template_ecard>>> - END
******************************************************************************/
from themes/sample/theme.php into a new line before
Code: [Select]
?>of the file themes/yourtheme/theme.php
Finally, edit that section as you see fit. Again, don't mess with the placeholders in curly braces.

You'll notice that we have spend a lot of time and effort into the creation of the documentation for cpg1.5.x, which contains a lot more of information how to edit Coppermine's theme to match your taste, so you might want to read http://documentation.coppermine-gallery.net/en/theme_create.htm#theme_create  ff.
Logged

flyegye

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Where are notification e-mails bodies located?
« Reply #4 on: March 29, 2010, 06:56:51 am »

Thank you!!! Exactly what I was looking for. Very thorough and easy to follow directions.

Thanks for taking the time to help! I really appreciate it.

Tommy
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 22 queries.