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: email notification when getting a comment on image  (Read 1067 times)

0 Members and 1 Guest are viewing this topic.

Dark_Angel

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
email notification when getting a comment on image
« on: July 25, 2018, 07:23:31 am »

I was given this code many years agao and it works very well...I was just wondering if by chance there is a way to get it to NOT send out a notification when there is no email or username for the image commented on. The notice I get being  the main admin is telling me there was no way to send the notice of comment.

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));
            }
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1081
Re: email notification when getting a comment on image
« Reply #1 on: July 25, 2018, 12:42:39 pm »

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);
                if ($owner && $owner[0]['user_email']) {
                    $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));
                }
            }
Logged

Dark_Angel

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: email notification when getting a comment on image
« Reply #2 on: August 03, 2018, 04:36:20 am »

Sorry so late in answering you, been very sick and this forum did not notify me of a reply.

I will try this and let you know what happens. thanks
Logged
Pages: [1]   Go Up
 

Page created in 0.05 seconds with 21 queries.