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 [2] 3   Go Down

Author Topic: Email users on new comments  (Read 68492 times)

0 Members and 1 Guest are viewing this topic.

cmfa

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 226
Re: Email users on new comments
« Reply #20 on: May 16, 2011, 09:07:40 pm »

hi,

Problem is solved for me, I put the following code in between, adding a new entry in the $ mail_body. Now pictures are transmitted. A little tinkering in the appearance ...

Code: [Select]
        $result = cpg_db_query("SELECT url_prefix, filepath, filename, title, caption, pwidth, pheight FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE pid='$pid' $FORBIDDEN_SET");
        $row = mysql_fetch_assoc($result);
        $normal_pic_url = get_pic_url($row, 'normal');
        $gallery_url_prefix = $CONFIG['ecards_more_pic_target']. (substr($CONFIG['ecards_more_pic_target'], -1) == '/' ? '' : '/');
        if (!stristr($normal_pic_url, 'http:')) {
        $normal_pic_url = $gallery_url_prefix . $normal_pic_url;}
        $pic_markup = '<img src="'.$normal_pic_url.'" alt="" vspace="8" border="0" class="image" />';

CMFA
Logged

jmcreis

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
Re: Email users on new comments
« Reply #21 on: May 17, 2011, 12:06:36 am »

If this sends the picture, I do not think is good.
My gallery, for example, has the photos protected by transparent gif to hinder copying.
If the email sends the original ...
What I think that is enough to send the thumbnail as link to the photo in the gallery.
Logged

cmfa

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 226
Re: Email users on new comments
« Reply #22 on: May 17, 2011, 08:23:59 pm »

hi,
in the e-mail transmission and the watermark is present. Thus, the no problem

cmfa
Logged

jmcreis

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
Re: Email users on new comments
« Reply #23 on: May 17, 2011, 09:03:44 pm »

Thank you for the info
Logged

christophg

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Email users on new comments
« Reply #24 on: June 23, 2011, 12:16:04 am »

You can say a big 'Thank you' to jmcreis, who was ready to pay to put this modification to the top on my to-do list :)

Replace my first modification with the following code:
Code: [Select]
        $result = cpg_db_query("SELECT filename, title, owner_id FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = $pid LIMIT 1");
        $picture = cpg_db_fetch_rowset($result);
        mysql_free_result($result);
        if ($picture[0]['owner_id'] != USER_ID) {
            $user_id_array[] = $picture[0]['owner_id'];
        }

        $result = cpg_db_query("SELECT author_id FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = $pid AND author_id != 0");
        while ($row = mysql_fetch_assoc($result)) {
            if ($row['author_id'] != USER_ID) {
                $user_id_array[] = $row['author_id'];
            }
        }
        mysql_free_result($result);

        if (count($user_id_array)) {
            global $cpg_udb;
            $title = $picture[0]['title'] ? $picture[0]['title'] : $picture[0]['filename'];
            $mail_body = "Your picture '$title' has received a new comment. You can see it at " . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
            $result = cpg_db_query("SELECT ".$cpg_udb->field['email']." AS user_email FROM ".$cpg_udb->usertable." WHERE ".$cpg_udb->field['user_id']." IN (".implode(', ', $user_id_array).")");
            while ($row = mysql_fetch_assoc($result)) {
                cpg_mail($row['user_email'], $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }
            mysql_free_result($result);
        }

Hello Andre...

First, I am totally new to coppermine and have version 1.5.12 installed...What a phenomenal program. It solved all my photography club needs...!
Secondly, it has been hours spent trying to find a current thread related to sending the owner of a photo an e-mail, after someone makes a commetn on his image...So I am grateful I found this and hopes it is my solution.
Thirdly, I am new to this Forum and hope I am not posting this inquery in the wrong area...If so I apologize in advance.

After reading these threads, it appears that this e-mail notification code has been finalized and resolved, and the person who uploads an image receives an email stating that a comment has been made on his image...?

If so, and if I understand your instructions, I have to locate a file named db_input.php somewhere on my external server and add the last, modified code you supplied...? Do I simply insert the above code in a new line, after I find the initial code...?

What exactly does this final code do...(1) Notify the original author that a comment has been made and (2) notify the person who made the comment that a comment had been made...?

You can see my site here: http://www.grooppa.com/coppermine/index.php?cat=0

Thanks so much in advance...Respectfully...Christoph
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 947
  • +Tinyportal Support team.
Re: Email users on new comments
« Reply #25 on: June 23, 2011, 12:39:21 am »


If so, and if I understand your instructions, I have to locate a file named db_input.php somewhere on my external server and add the last, modified code you supplied...? Do I simply insert the above code in a new line, after I find the initial code...?


Have another read of the thread (Page one), Andre tell you what part of the code to find, and what to add underneath it. ;)


What exactly does this final code do...(1) Notify the original author that a comment has been made and (2) notify the person who made the comment that a comment had been made...?


It will do either 1 or 2 or both.  The first code that Andre posted will  "(1) Notify the original author that a comment has been made."  Read on, and you'll find the next part which adds, "(2) notify the person who made the comment that a comment had been made...?"
 
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

christophg

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Email users on new comments
« Reply #26 on: June 23, 2011, 12:49:45 am »

Hello Lurkalot...

Thanks for your quick reply...
I'm going to go ahead and add the "modified code" which Andre supplied.

I suppose no harm can be done. A simple removal of the code should put Coppermine back into its original condition.
Thanks, I'll give it a try...I will also report back, for the benefit of others.

Christoph
Logged

christophg

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Email users on new comments
« Reply #27 on: June 23, 2011, 02:25:18 am »

Hello Lurkalot...

I placed the code according to Andre's instructions.
No error messages were received. However, the member of the gallery did not receive a message stating that a comment was made on her image.
I received the normal message from coppermine, which tells me that a comment has been made "on the gallery" (this is the default which I turned on in the coppermine configuration).

The e-mail notification code does not work, or what am I doing wrong...?

Thanks...

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Email users on new comments
« Reply #28 on: June 23, 2011, 10:12:52 am »

Note that you'll only receive an email, if someone else posts a new comment on your picture.
Logged

christophg

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Email users on new comments
« Reply #29 on: June 23, 2011, 04:26:57 pm »

Thanks for responding...

Perhaps I don't understand Lurkalot's responses to my questions. Should I have included your first code example, in order for members to receive e-mails...? I inserted your second  "Modified Code" only.

In response to your comment, I placed a comment under another photographer's image, not my own. That photographer did not receive a notice that a comment was made on his image.

Where am I missing this...? Thanks...
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Email users on new comments
« Reply #30 on: June 23, 2011, 04:38:39 pm »

Please attach your modified db_input.php file as zip file to your next reply.
Logged

christophg

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Email users on new comments
« Reply #31 on: June 23, 2011, 04:49:41 pm »

Hello Andre...
Thanks for your assistance. Enclosed is zipped modified db_input.php
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Email users on new comments
« Reply #32 on: June 23, 2011, 04:59:20 pm »

You pasted the code at the wrong location. Undo your change and read carefully where you have to add the code.
Logged

christophg

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Email users on new comments
« Reply #33 on: June 23, 2011, 05:12:56 pm »

Hello Andrea...

My sincere apology for this error on my part...!
Thanks so much for taking your time to help me with this...I will make correction and test. I should have a response from a photographer within 2 hours and I will respond with the result.

Thanks...Christoph
Logged

christophg

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Email users on new comments
« Reply #34 on: June 23, 2011, 07:25:06 pm »

Hello Andre...

I have corrected my "placement of code" error and everything is working.
I would like to extend a big gratitude for helping me with this...! It is greatly, greatly appreciated...!

On another note, can the code be modified to replace the "image.jpg" reference in the e-mail with a thumbnail of the image?
In reading through the thread, It appears this has been tried, but never resolved?

Again, my deepest gratitude for your help...!

Christoph
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Email users on new comments
« Reply #35 on: June 24, 2011, 09:09:29 am »

can the code be modified to replace the "image.jpg" reference in the e-mail with a thumbnail of the image?
In reading through the thread, It appears this has been tried, but never resolved?
I assume you're talking about the code provided by cmfa? If so, just follow his instructions and then find
Code: [Select]
$normal_pic_url = get_pic_url($row, 'normal');and replace with
Code: [Select]
$normal_pic_url = get_pic_url($row, 'thumb');to use the thumbnail instead of the intermediate-sized image.
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 947
  • +Tinyportal Support team.
Re: Email users on new comments
« Reply #36 on: April 13, 2015, 09:24:40 am »

Please try the following. Open db_input.php, find
Code: [Select]
            if ($CONFIG['email_comment_notification'] && !USER_IS_ADMIN ) {
                $mail_body = "<p>" . bb_decode(process_smilies($msg_body, $CONFIG['ecards_more_pic_target'])) . '</p>' . $LINEBREAK .$lang_db_input_php['email_comment_body'] . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
                cpg_mail('admin', $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }
and below, add
Code: [Select]
            $result = cpg_db_query("SELECT filename, title, owner_id FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = $pid LIMIT 1");
            $picture = cpg_db_fetch_rowset($result);
            mysql_free_result($result);
            if ($picture[0]['owner_id'] && $picture[0]['owner_id'] != USER_ID) {
                global $cpg_udb;
                $result = cpg_db_query("SELECT ".$cpg_udb->field['username']." AS user_name, ".$cpg_udb->field['email']." AS user_email FROM ".$cpg_udb->usertable." WHERE ".$cpg_udb->field['user_id']." = {$picture[0]['owner_id']} LIMIT 1");
                $owner = cpg_db_fetch_rowset($result);
                mysql_free_result($result);
                $title = $picture[0]['title'] ? $picture[0]['title'] : $picture[0]['filename'];
                $mail_body = "Your picture '$title' has received a new comment. You can see it at " . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
                cpg_mail($owner[0]['user_email'], $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }

Andre, has something changed in the latest versions of Coppermine, I can't seem to make this work any more, and users not receiving emails.  Any ideas?
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Email users on new comments
« Reply #37 on: April 13, 2015, 10:26:07 am »

The code you posted sends an email to the owner of a picture when a new comment has been added. I had a short look at that code and don't see a reason why it shouldn't work.
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 947
  • +Tinyportal Support team.
Re: Re: Email users on new comments
« Reply #38 on: April 13, 2015, 08:57:42 pm »

The code you posted sends an email to the owner of a picture when a new comment has been added. I had a short look at that code and don't see a reason why it shouldn't work.

Andre, thanks.  I finally got around to upgrading to 1.5.34 and obviously had to add the code again.  But can't get it to work whatsoever. I've done the edit, and redone it to make sure, but nope, still won't work. It was working before I upgraded though, hence my question. ;)
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Email users on new comments
« Reply #39 on: April 14, 2015, 01:00:37 am »

Nothing jumping out at me either...
On my list to do something in this area - if someone can beat me to it....
I had a plugin call added here in 1.5.28:
Code: [Select]
        CPGPluginAPI::action('comment_add', array('msg_id' => cpg_db_last_insert_id(), 'pid' => $pid, 'msg_author' => $msg_author, 'author_id' => USER_ID, 'msg_body' => $msg_body, 'approval' => $app));
for just this function.  I used code based on this thread (variation of André and cmfa's input from this thread and from some other comments) in another members gallery - and intended to convert to plugin for future use by others.
Just haven't had the time to work on the plugin yet.... Best laid plans.

Greg
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money
Pages: 1 [2] 3   Go Up
 

Page created in 0.027 seconds with 20 queries.