PDA

View Full Version : modify comment notification


btrancho
01-04-2007, 08:49 PM
I'd like to modify the email notification for comments so that the link to the posting remains the same but the text shows the text from the <IMAGE_TILE> tag. I'm not an experienced php coder but I have located the pertinent code in index.php (starting at line 1021) and it appears that I need to set a new variable for the image title and then plug that on on line 1063.

Any help will be greatly appreciated.

Bob
A Closeup View (http://www/acloseupview.com)
Trancho Photography (http://tranchophotography.com)

Dkozikowski
01-04-2007, 09:49 PM
try using

$image_title

in that code you pointed out. Place it where you would like to show the image title. For example:

// HTML note email
$body = "$lang_email_notification_pt1
<a href='$link_to_comment'>$link_to_comment</a><br>
$image_title<br>
$img_thumb_cmmnt<br>
$lang_email_notification_pt2
$comment_message<br>
$lang_email_notification_pt3 <a href='$comment_url' >$comment_name</a> - $comment_email <br>
$lang_email_notification_pt4
";


If this does not work let me know. There might be one more process to complete.

btrancho
01-04-2007, 10:31 PM
try using

$image_title

in that code you pointed out. Place it where you would like to show the image title. For example:

// HTML note email
$body = "$lang_email_notification_pt1
<a href='$link_to_comment'>$link_to_comment</a><br>
$image_title<br>
$img_thumb_cmmnt<br>
$lang_email_notification_pt2
$comment_message<br>
$lang_email_notification_pt3 <a href='$comment_url' >$comment_name</a> - $comment_email <br>
$lang_email_notification_pt4
";


If this does not work let me know. There might be one more process to complete.
Thanks but that's a no go... I just get a blank. Looks to me like $image_title would have to be declared as a variable first - that's where my lack of php trips me up.

Dkozikowski
01-04-2007, 10:35 PM
Thanks but that's a no go... I just get a blank. Looks to me like $image_title would have to be declared as a variable first - that's where my lack of php trips me up.

yes, you're right and that was the extra step i said that might be needed. Hold on for a few and let me look at the code.

Dkozikowski
01-04-2007, 10:38 PM
Try this:

if(isset($_GET['x'])&&$_GET['x'] == "save_comment")
{
if($cfgrow['commentemail'] == "yes" && $email_flag == 1)
{
$admin_email = $cfgrow['email'];
$comment_name = clean_comment($_POST['name']);
$comment_url = clean_comment($_POST['url']);
if(strpos($comment_url,'https://') === false && strpos($comment_url,'http://') === false && strlen($comment_url) > 0) $comment_url = "http://".$comment_url;
$comment_image_id = $_POST['parent_id'];
$comment_message = clean_comment($_POST['message']);
$comment_message = stripslashes($comment_message);
$comment_email = clean_comment($_POST['email']);
$link_to_comment = $cfgrow['siteurl']."./index.php?showimage=$comment_image_id";
$comment_image_name = clean_comment($_POST['parent_name']);
$link_to_comment = $cfgrow['siteurl']."?showimage=$comment_image_id";
$link_to_img_thumb_cmmnt = "Thumbnail Link:" .$cfgrow['siteurl'] ."thumbnails/thumb_$comment_image_name";
$img_thumb_cmmnt = "<img src='" .$cfgrow['siteurl'] ."thumbnails/thumb_$comment_image_name' >";
$image_title = pullout($row['headline']);
$image_title = htmlspecialchars($image_title,ENT_QUOTES);
$subject = "$pixelpost_site_title - $lang_email_notification_subject";
$sent_date = gmdate("Y-m-d",time()+(3600 * $cfgrow['timezone'])) ;
$sent_time = gmdate("H:i",time()+(3600 * $cfgrow['timezone'])) ;

if ($cfgrow['htmlemailnote']!='yes')
{
// Plain text note email
$body = "$lang_email_notificationplain_pt1 : $link_to_comment\n\n$lang_email_notificationplain_ pt2\n\n$comment_message\n\n$lang_email_notificatio nplain_pt3: $comment_name";
if ($comment_email!="") {$body .= "- $comment_email";}
$body .= "\n\n$lang_email_notificationplain_pt4";
$headers = "Content-type: text/plain; charset=UTF-8\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";

if ($comment_email!="") $headers .= "From: $comment_name<$comment_email>\n";
else $headers .= "From: PIXELPOST <$admin_email>\n";
$recipient_email = "admin <$admin_email>";
}
else
{
// HTML note email
$body = "$lang_email_notification_pt1
<a href='$link_to_comment'>$link_to_comment</a><br>
$img_thumb_cmmnt<br>
$image_title<br>
$lang_email_notification_pt2
$comment_message<br>
$lang_email_notification_pt3 <a href='$comment_url' >$comment_name</a> - $comment_email <br>
$lang_email_notification_pt4
";

btrancho
01-04-2007, 11:47 PM
I see what you were trying - to pull the mysql query from the previous
feed code, but that didn't work.

Instead I got it to work by doing the following:

1 - add this line to comment_template.html just below similar code for 'parent_id'

<input type='hidden' name='parent_title' value='<IMAGE_TITLE>' />

2 - insert this line at 1032 of index.php

$image_title = clean_comment($_POST['parent_title']);

3 - change '$link_to_comment' on what is now line 1064 to '$image_title'

Now the image title is the link back to the post.

Thanks for the help - it got me looking closer at the code and i realized that they were pulling most data from the comment template.

Now - can anyone tell me where the actual text inserted by '$lang_email_notification_pt1' can be found?

Thanks again,
Bob

Dkozikowski
01-05-2007, 01:03 AM
Good job. Thats another way to do it. I know it can be done without adding anything but your was is fine.

You will find $lang_email_notification_pt1

in your language file located in the language folder

If your using the english language it would be lang-english.php

line 117