Author Topic: [Mod] Mail Owner of image when Comment is Posted  (Read 241606 times)

0 Members and 1 Guest are viewing this topic.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #90 on: January 21, 2006, 05:01:12 AM »
Well, I do not see ANYWHERE ABOVE that you were talking about the $image_link. You only, as usual, questionned my modification without any specifics.  :?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #91 on: January 21, 2006, 05:05:34 AM »
So, you are a robot! or a bot? You dont understand if one tells you a clue, and not pointing directly to the issue...very narrow minded...

whatever. Just be quiet, please.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #92 on: January 21, 2006, 06:56:49 PM »
Why admins do not receive comments for their images?
Only admins? have you tested it with regular member(s) or more then one admin account with VALID email address?
Nevermind V@no I've found the problem.
Now another question to the MOD'S author:
Can I disable notification on comments made by myself?
I mean I don't want to receive my own comments.
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #93 on: January 21, 2006, 07:15:09 PM »
I'd suggest you using this code instead:
http://www.4homepages.de/forum/index.php?topic=2705.msg14792#msg14792
then replace
Code: [Select]
if ($user_allowemails == 1) {with:
Code: [Select]
if ($image_row['user_id'] != $user_info['user_id'] && $user_allowemails == 1) {
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #94 on: January 22, 2006, 01:43:07 AM »
I'd suggest you using this code instead:
http://www.4homepages.de/forum/index.php?topic=2705.msg14792#msg14792
then replace
Code: [Select]
if ($user_allowemails == 1) {with:
Code: [Select]
if ($image_row['user_id'] != $user_info['user_id'] && $user_allowemails == 1) {
Wow V@no! It works!
Thank you.
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #95 on: January 22, 2006, 02:51:32 AM »
[EDITED]
All right I've made all corrections specified above & below (till this reply) and the final code was (it works  :wink: ):
Code: [Select]
//-----------------------------------------------------
// Start Emailer for comments
//-----------------------------------------------------
   $recipient_name = $image_row['user_name'];
   $recipient_email = $image_row['user_email'];
   $image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id;

   $sql = "SELECT user_allowemails FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_name")." = ".$recipient_name;
   $result = $site_db->query($sql);
   $row = $site_db->fetch_array($result);
   $user_allowemails = ($row['user_allowemails']);

   if ($image_row['user_id'] != $user_info['user_id'] && $user_allowemails == 1) {
   include(ROOT_PATH.'includes/email.php');
   $site_email = new Email();
   $site_email->set_to($recipient_email);
   $site_email->set_from($config['site_email'], $config['site_name']);
   $site_email->set_subject($lang['send_comment_emailsubject']);
   $site_email->register_vars(array(
     "user_name" => stripslashes($user_name),
     "recipient_name" => stripslashes($image_row['user_name']),
     "image_name" => $image_row['image_name'],
     "comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
     "site_name" => $config['site_name'],
     "image_url" => $image_url,
     "comment_text" =>(stripslashes($comment_text)),
     "comment_headline"=>(stripslashes($comment_headline)),
          ));
    $site_email->set_body("comment_email", $config['language_dir']);
    $site_email->send_email();
    }
    }
  }
 unset($row);
 unset($spam_row);
}

Don't forget to add:
Code: [Select]
$lang['send_comment_emailsubject'] = "COMMENT_NOTIFICATION_SUBJECT_HERE";
to /lang/language/main.php

PS.It will also disable sending you your own comments.

Perhaps I'd be useful for someone ...
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #96 on: January 22, 2006, 03:00:42 AM »
@fgallery:

Looks good. However, these two lines :

Quote

$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id."";

$sql = "SELECT user_allowemails FROM ".USERS_TABLE." WHERE user_name = '$recipient_name'";


could also simply be stated like this :

Quote

$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id;

$sql = "SELECT user_allowemails FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_name")." = ".$recipient_name;


;)

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #97 on: January 22, 2006, 03:05:05 AM »
@fgallery:

Looks good. However, these two lines :

Quote

$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id."";

$sql = "SELECT user_allowemails FROM ".USERS_TABLE." WHERE user_name = '$recipient_name'";


could also simply be stated like this :

Quote

$image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id;

$sql = "SELECT user_allowemails FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_name")." = ".$recipient_name;


;)
Does it make any difference?
Sorry, I'm not a coder :)
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #98 on: January 22, 2006, 03:10:49 AM »
@fgallery:

Well, if you compare both of these quotes, you can see there are more " with your strings.

Example :

Quote

URL_IMAGE_ID."=".$id."";


when it could simply be :

Quote

URL_IMAGE_ID."=".$id;


since there are no beginning with == > "  < == after the "= (equality) ". ;)

As for :

Quote

".get_user_table_field("", "user_name")."


Yes, there is since the user_name field is not an additional user field but a core field from the USERS_TABLE. ;)

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #99 on: January 22, 2006, 03:21:31 AM »
I've upadated my full code, thanks!

PS.I thought your corrections would also fix this problem:
If I write for e.g. testin' in Hedline and/or Comment I'll receive it as testin\'
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #100 on: January 22, 2006, 03:23:15 AM »
Quote

If I write for e.g. testin' in Hedline and/or Comment I'll receive it as testin\'


In your codings, make sure that the related query $HTTP_POST_VARS contains the stripslashes module with it. ;)

If you're not sure where exacly this line might be in the code (and if the code itself is NOT too big) please post it here as I will take a look at it. ;)

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #101 on: January 22, 2006, 03:26:44 AM »
Update :

I found it. You're probably talking about this line :

Quote

"comment_headline"=>$comment_headline,


change it to :

Code: [Select]

"comment_headline"=>(stripslashes($comment_headline)),


;)

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #102 on: January 22, 2006, 03:32:05 AM »
Update :

I found it. You're probably talking about this line :

Quote

"comment_headline"=>$comment_headline,


change it to :

Code: [Select]

"comment_headline"=>(stripslashes($comment_headline)),


;)
I guess I should do the same with 'comment_text'.
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #103 on: January 22, 2006, 03:34:26 AM »
Quote

I guess I should do the same with 'comment_text'.


Precisely. 8)

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [Mod] Mail Owner of image when Comment is Posted
« Reply #104 on: January 22, 2006, 09:39:54 PM »
[EDITED]
All right I've made all corrections specified above & below (till this reply) and the final code was (it works  :wink: ):
Code: [Select]
//-----------------------------------------------------
// Start Emailer for comments
//-----------------------------------------------------
   $recipient_name = $image_row['user_name'];
   $recipient_email = $image_row['user_email'];
   $image_url = $script_url."/details.php?".URL_IMAGE_ID."=".$id;

   $sql = "SELECT user_allowemails FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_name")." = ".$recipient_name;
   $result = $site_db->query($sql);
   $row = $site_db->fetch_array($result);
   $user_allowemails = ($row['user_allowemails']);

   if ($image_row['user_id'] != $user_info['user_id'] && $user_allowemails == 1) {
   include(ROOT_PATH.'includes/email.php');
   $site_email = new Email();
   $site_email->set_to($recipient_email);
   $site_email->set_from($config['site_email'], $config['site_name']);
   $site_email->set_subject($lang['send_comment_emailsubject']);
   $site_email->register_vars(array(
     "user_name" => stripslashes($user_name),
     "recipient_name" => stripslashes($image_row['user_name']),
     "image_name" => $image_row['image_name'],
     "comment_date" => format_date($config['date_format']." ".$config['time_format'], $current_time),
     "site_name" => $config['site_name'],
     "image_url" => $image_url,
     "comment_text" =>(stripslashes($comment_text)),
     "comment_headline"=>(stripslashes($comment_headline)),
          ));
    $site_email->set_body("comment_email", $config['language_dir']);
    $site_email->send_email();
    }
    }
  }
 unset($row);
 unset($spam_row);
}

Don't forget to add:
Code: [Select]
$lang['send_comment_emailsubject'] = "COMMENT_NOTIFICATION_SUBJECT_HERE";
to /lang/language/main.php

PS.It will also disable sending you your own comments.

Perhaps I'd be useful for someone ...

What do this??? Mail at new comments on/off???
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-