Advanced search  

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

Pages: [1]   Go Down

Author Topic: email notification when getting a comment on image  (Read 3240 times)

0 Members and 1 Guest are viewing this topic.

Dark_Angel

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
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

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
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: 16
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.025 seconds with 19 queries.