Email users on new comments - Page 2 Email users on new comments - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Email users on new comments

Started by lurkalot, March 01, 2011, 07:31:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cmfa

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 ...


        $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

jmcreis

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.

cmfa

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

cmfa

jmcreis


christophg

Quote from: Αndré on April 29, 2011, 06:36:45 PM
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:
        $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

lurkalot

Quote from: christophg on June 23, 2011, 12:16:04 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. ;)

Quote from: christophg on June 23, 2011, 12:16:04 AM

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...?"
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

christophg

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

christophg

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...


Αndré

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

christophg

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...

Αndré

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

christophg

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

Αndré

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

christophg

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

christophg

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

Αndré

Quote from: christophg on June 23, 2011, 07:25:06 PM
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
$normal_pic_url = get_pic_url($row, 'normal');
and replace with
$normal_pic_url = get_pic_url($row, 'thumb');
to use the thumbnail instead of the intermediate-sized image.

lurkalot

Quote from: Αndré on March 02, 2011, 10:16:10 AM
Please try the following. Open db_input.php, find
            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
            $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?
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré

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.

lurkalot

Quote from: Αndré 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.

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. ;)
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

gmc

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:

        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
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money