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]   Go Down

Author Topic: E-Mail Notification To Members On Comments  (Read 46151 times)

0 Members and 1 Guest are viewing this topic.

nanothree

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 70
    • RockThoseLocks
Re: E-Mail Notification To Members On Comments
« Reply #20 on: April 10, 2005, 02:28:02 pm »

ermm, any idea how i fix this?
Logged

Nibbler

  • Guest
Re: E-Mail Notification To Members On Comments
« Reply #21 on: April 10, 2005, 02:29:22 pm »

Ah, is this a comment on an anonymously uploaded pic ?
Logged

nanothree

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 70
    • RockThoseLocks
Re: E-Mail Notification To Members On Comments
« Reply #22 on: April 10, 2005, 03:47:04 pm »

it seems to have stopped now, but that would be a problem, would it be possible to stop that error from happening if that was the case?

BTW i have made it possible to turn this feature on and off from the config page
Code: [Select]
if ($CONFIG['email_user_comment_notification']) {

if (defined('UDB_INTEGRATION')){
$result = db_query("SELECT owner_id  FROM {$CONFIG['TABLE_PICTURES']} WHERE pid=".$pid);
list($uid) = mysql_fetch_row($result);
$picture_owner_data = udb_get_user_infos($uid);
} else {
// send an email to the owner of the picture
$result = db_query("SELECT user_name,user_email FROM {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_USERS']} AS u WHERE u.user_id=p.owner_id and p.pid=".$pid);
$picture_owner_data = mysql_fetch_array($result);
}
$subject = "New GJPix Comment by ".USER_NAME;
$mail_body  = "Hi ".$picture_owner_data['user_name']."!\n\n".USER_NAME." just wrote a comment on one of your photos, click the link below to read and reply to it.\n";
$mail_body .= "http://gallery.greatestjournal.com/displayimage.php?pos=-".$pid;
cpg_mail($picture_owner_data['user_email'], $subject, $mail_body, 'text/plain', "GJPix", 'dontreply@yourdomain.com');

}

then you need to add a new row to the config table, you can use this sql query:
Code: [Select]
INSERT INTO `cpg11d_config` ( `name` , `value` )
VALUES (
'email_user_comment_notification', 1
)

change cpg11d to what your table prefix is

and finally find, in lang/englsih.php
Code: [Select]
  array('Notify admin of comments by email', 'email_comment_notification', 1), //cpg1.3.0
and after it add
Code: [Select]
array('Allow users to recieve email when comments are posted', 'email_user_comment_notification', 1),
from this it should be very easy to add a check for user approval, but i am yet to implement this
« Last Edit: April 10, 2005, 04:32:37 pm by nanothree »
Logged

protox

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 49
  • Digital Photographer
    • x-poz
Re: E-Mail Notification To Members On Comments
« Reply #23 on: April 12, 2005, 05:08:48 pm »

I've tryed this mod .. but I don't receive any mail ... and I don't understand why this doesn't work because the code seems to be working ...

Here is the code :

** EDIT :: ok; it's working .. I'm a poor stupid lame .. sorry :-X ;D **
« Last Edit: April 13, 2005, 10:34:45 am by protox »
Logged
Latest shot from " Les disséqueurs de société " :

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fx-poz.org%2Fcpmfetch%2Fcfimageget.php%3Fcmd%3Dlast&hash=edfea20327f42b3151d487941186eebf)

Chrigi

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: E-Mail Notification To Members On Comments
« Reply #24 on: May 02, 2005, 08:34:41 pm »

hi there

i've made this for my gallery (brigded for phpBB) but it doesn't work. i means, i've changed the code, and it works fine to add an comment, but i recieve no mail.
is there anything wrong in the DB query, if yes, can anybody make for me such an query for the phpBB?

greetz and thx
chrigi
Logged

Chrigi

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: E-Mail Notification To Members On Comments
« Reply #26 on: May 02, 2005, 09:07:32 pm »

hi Nibbler,

thank tou you for the answer,  i've tried it, but nothing works.
this is a piece of the code, starting at "//comment"
Code: [Select]
    // Comment

    case 'comment':
        if (!(USER_CAN_POST_COMMENTS)) cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);

        check_comment($HTTP_POST_VARS['msg_body']);
                check_comment($HTTP_POST_VARS['msg_author']);
        $msg_author = addslashes(trim($HTTP_POST_VARS['msg_author']));
        $msg_body = addslashes(trim($HTTP_POST_VARS['msg_body']));
        $pid = (int)$HTTP_POST_VARS['pid'];

        if ($msg_author == '' || $msg_body == '') cpg_die(ERROR, $lang_db_input_php['empty_name_or_com'], __FILE__, __LINE__);

        $result = db_query("SELECT comments FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND pid='$pid'");
        if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        $album_data = mysql_fetch_array($result);
        mysql_free_result($result);

        if ($album_data['comments'] != 'YES') cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);

        if (!$CONFIG['disable_comment_flood_protect']){
          $result = db_query("SELECT author_md5_id, author_id FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = '$pid' ORDER BY msg_id DESC LIMIT 1");
          if (mysql_num_rows($result)) {
              $last_com_data = mysql_fetch_array($result);
              if ((USER_ID && $last_com_data['author_id'] == USER_ID) || (!USER_ID && $last_com_data['author_md5_id'] == $USER['ID'])) {
                  cpg_die(ERROR, $lang_db_input_php['no_flood'], __FILE__, __LINE__);
              }
          }
        }

        if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
            $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, msg_raw_ip, msg_hdr_ip) VALUES ('$pid', '$msg_author', '$msg_body', NOW(), '{$USER['ID']}', '0', '$raw_ip', '$hdr_ip')");
            $USER['name'] = $HTTP_POST_VARS['msg_author'];
            $redirect = "displayimage.php?pos=" . (- $pid);
           if ($CONFIG['email_comment_notification']) {
            $mail_body = $msg_body . "\n\r ".$lang_db_input_php['email_comment_body'] . " " . $CONFIG['ecards_more_pic_target'] . $redirect;
cpg_mail($CONFIG['gallery_admin_email'], $lang_db_input_php['email_comment_subject'], $mail_body);

if (defined('UDB_INTEGRATION')){
$result = db_query("SELECT owner_id  FROM {$CONFIG['TABLE_PICTURES']} WHERE pid=".$pid);
list($uid) = mysql_fetch_row($result);
$picture_owner_data = udb_get_user_infos($uid);
} else {
// send an email to the owner of the picture
$result = db_query("SELECT user_name,user_email FROM {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_USERS']} AS u WHERE u.user_id=p.owner_id and p.pid=".$pid);
$picture_owner_data = mysql_fetch_array($result);
}
$subject = "New GJPix Comment by ".USER_NAME;
$mail_body  = "Hi ".$picture_owner_data['user_name']."!\n\n".USER_NAME." just wrote a comment on one of your photos, click the link below to read and reply to it.\n";
$mail_body .= "http://gallery.greatestjournal.com/displayimage.php?pos=-".$pid;
cpg_mail($picture_owner_data['user_email'], $subject, $mail_body, 'text/plain', "GJPix", 'webmaster@snaplife.ch');


            }

            pageheader($lang_db_input_php['com_added'], "<META http-equiv=\"refresh\" content=\"1;url=$redirect\">");
            msg_box($lang_db_input_php['info'], $lang_db_input_php['com_added'], $lang_continue, $redirect);
            pagefooter();
            ob_end_flush();
            exit;
        } else { // Registered users, we can use Location to redirect
            $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, msg_raw_ip, msg_hdr_ip) VALUES ('$pid', '" . addslashes(USER_NAME) . "', '$msg_body', NOW(), '', '" . USER_ID . "', '$raw_ip', '$hdr_ip')");
            $redirect = "displayimage.php?pos=" . (- $pid);
            if ($CONFIG['email_comment_notification']) {

                $mail_body = $msg_body . "\n\r ".$lang_db_input_php['email_comment_body'] . " " . $CONFIG['ecards_more_pic_target'] . $redirect;
                cpg_mail($CONFIG['gallery_admin_email'], $lang_db_input_php['email_comment_subject'], $mail_body);
            }
         $header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
            header($header_location . $redirect);
            pageheader($lang_db_input_php['com_added'], "<META http-equiv=\"refresh\" content=\"1;url=$redirect\">");
            msg_box($lang_db_input_php['info'], $lang_db_input_php['com_added'], $lang_continue, $redirect);
            pagefooter();
            ob_end_flush();
            exit;
        }
        break;

Can you please tell me, where I make the fault?

greetz n thx
chrigi
Logged

Nibbler

  • Guest
Re: E-Mail Notification To Members On Comments
« Reply #27 on: May 02, 2005, 09:16:17 pm »

Wrong place, put it after the other

Code: [Select]
if ($CONFIG['email_comment_notification']) {
Logged

Chrigi

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: E-Mail Notification To Members On Comments
« Reply #28 on: May 02, 2005, 09:41:38 pm »

ough

I felt a bit sheepish about it.
but now it works, thanks a lot  :D ;D

greetz
chrigi
Logged

Rallemann

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: E-Mail Notification To Members On Comments
« Reply #29 on: May 10, 2005, 07:36:04 pm »

then you need to add a new row to the config table, you can use this sql query:
Code: [Select]
INSERT INTO `cpg11d_config` ( `name` , `value` )
VALUES (
'email_user_comment_notification', 1
)

change cpg11d to what your table prefix is


Which file do I have to edit?
I can't find a similar code in config.php
In which line the text has to been added?

thanks for support =)
Logged

Nibbler

  • Guest
Re: E-Mail Notification To Members On Comments
« Reply #30 on: May 10, 2005, 07:41:15 pm »

You need to run the query on your database using phpmyadmin or similar.
Logged

blobnl

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: E-Mail Notification To Members On Comments
« Reply #31 on: June 14, 2005, 06:26:07 pm »

Hi i followed the instruction but i do not recieve any email.. (as admin i will receive the comment emails)
Here is my code can anyone tell me if this is ok ?
Code: [Select]
   // Comment

    case 'comment':
        if (!(USER_CAN_POST_COMMENTS)) cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);

        check_comment($HTTP_POST_VARS['msg_body']);
        $msg_author = addslashes(trim($HTTP_POST_VARS['msg_author']));
        $msg_body = addslashes(trim($HTTP_POST_VARS['msg_body']));
        $pid = (int)$HTTP_POST_VARS['pid'];

        if ($msg_author == '' || $msg_body == '') cpg_die(ERROR, $lang_db_input_php['empty_name_or_com'], __FILE__, __LINE__);

        $result = db_query("SELECT comments FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND pid='$pid'");
       


        //MATEJ DOPESNU
        if ($pid == 0) {
        } else {
           if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap'], __FILE__, __LINE__);
        }
        //-------------
        $album_data = mysql_fetch_array($result);
        mysql_free_result($result);
       
//MATEJ DOPESNU
        if ($pid == 0) {
        } else {
           if ($album_data['comments'] != 'YES') cpg_die(ERROR, $lang_errors['perm_denied'], __FILE__, __LINE__);
        }        
        //-------------
       

        if (!$CONFIG['disable_comment_flood_protect']){
          $result = db_query("SELECT author_md5_id, author_id FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = '$pid' ORDER BY msg_id DESC LIMIT 1");
          if (mysql_num_rows($result)) {
              $last_com_data = mysql_fetch_array($result);
              if ((USER_ID && $last_com_data['author_id'] == USER_ID) || (!USER_ID && $last_com_data['author_md5_id'] == $USER['ID'])) {
                  cpg_die(ERROR, $lang_db_input_php['no_flood'], __FILE__, __LINE__);
              }
          }
        }

        if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
            $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, msg_raw_ip, msg_hdr_ip) VALUES ('$pid', '$msg_author', '$msg_body', NOW(), '{$USER['ID']}', '0', '$raw_ip', '$hdr_ip')");
            $USER['name'] = $HTTP_POST_VARS['msg_author'];
            //MATEJ DOPESNU
            if ($pid == 0) {
         $redirect = "index.php";
            } else {
              $redirect = "displayimage.php?pos=" . (- $pid);        
            }
            //-------------
            if ($CONFIG['email_comment_notification']) {
                $mail_body = $msg_body . "\n\r ".$lang_db_input_php['email_comment_body']." http://" . $_SERVER["SERVER_NAME"] . "/" . $redirect;
                cpg_mail($CONFIG['gallery_admin_email'], $lang_db_input_php['email_comment_subject'], $mail_body);
            }
            pageheader($lang_db_input_php['com_added'], "<META http-equiv=\"refresh\" content=\"1;url=$redirect\">");
            msg_box($lang_db_input_php['info'], $lang_db_input_php['com_added'], $lang_continue, $redirect);
            pagefooter();
            ob_end_flush();
            exit;
        } else { // Registered users, we can use Location to redirect
            $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, msg_raw_ip, msg_hdr_ip) VALUES ('$pid', '" . addslashes(USER_NAME) . "', '$msg_body', NOW(), '', '" . USER_ID . "', '$raw_ip', '$hdr_ip')");
            //MATEJ DOPESNU
            if ($pid == 0) {
         $redirect = "index.php";
            } else {
              $redirect = "displayimage.php?pos=" . (- $pid);        
            }
            //-------------
            if ($CONFIG['email_comment_notification']) {
                $mail_body = $msg_body . "\n\r ".$lang_db_input_php['email_comment_body']." http://" . $_SERVER["SERVER_NAME"] . "/" . $redirect;
                cpg_mail($CONFIG['gallery_admin_email'], $lang_db_input_php['email_comment_subject'], $mail_body);
            }
            $header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
            header($header_location . $redirect);
            pageheader($lang_db_input_php['com_added'], "<META http-equiv=\"refresh\" content=\"1;url=$redirect\">");
            msg_box($lang_db_input_php['info'], $lang_db_input_php['com_added'], $lang_continue, $redirect);
            pagefooter();
            ob_end_flush();
            exit;
        }
if ($CONFIG['email_user_comment_notification']) {

if (defined('UDB_INTEGRATION')){
$result = db_query("SELECT owner_id  FROM {$CONFIG['TABLE_PICTURES']} WHERE pid=".$pid);
list($uid) = mysql_fetch_row($result);
$picture_owner_data = udb_get_user_infos($uid);
} else {
// send an email to the owner of the picture
$result = db_query("SELECT user_name,user_email FROM {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_USERS']} AS u WHERE u.user_id=p.owner_id and p.pid=".$pid);
$picture_owner_data = mysql_fetch_array($result);
}
$subject = "New GJPix Comment by ".USER_NAME;
$mail_body  = "Hi ".$picture_owner_data['user_name']."!\n\n".USER_NAME." just wrote a comment on one of your photos, click the link below to read and reply to it.\n";
$mail_body .= "http://gallery.greatestjournal.com/displayimage.php?pos=-".$pid;
cpg_mail($picture_owner_data['user_email'], $subject, $mail_body, 'text/plain', "GJPix", 'dontreply@yourdomain.com');

}
        break;

    // Update album
Logged
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2F82.156.219.246%2Ffotoforum%2Fpic.jpg&hash=ce33d1cfea7430feef4f437eefcd9e00)

chupa2k

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: E-Mail Notification To Members On Comments
« Reply #32 on: July 11, 2005, 05:29:12 pm »

I have a question , Will this work with IPB 1.3 bridge ??? this is just what i need .
Logged

AWJunkies

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
Re: E-Mail Notification To Members On Comments
« Reply #33 on: January 31, 2006, 12:14:00 am »

Edited to work with 1.4.3 stand alone as well as E-mail link becomes clickable now. THIS IS FOR NON BRIDGED VERSIONS the UDB blah balh wasnt working because 1.4.3 doesn't have the function called opon to grab photo infos. If someone wants it for bridged version as well I will find the new function for the same thing if needed.

db_input.php
FIND:
Code: [Select]
if ($CONFIG['email_comment_notification'] && !USER_IS_ADMIN ) {ADD BEFORE:
Code: [Select]
if ($CONFIG['email_user_comment_notification']) {

// send an email to the owner of the picture
$result = cpg_db_query("SELECT user_name,user_email FROM {$CONFIG['TABLE_PICTURES']} AS p, {$CONFIG['TABLE_USERS']} AS u WHERE u.user_id=p.owner_id and p.pid=".$pid);
$picture_owner_data = mysql_fetch_array($result);
$subject = "New GJPix Comment by ".USER_NAME;
$mail_body  = "Hi ".$picture_owner_data['user_name']."!\n\n".USER_NAME." just wrote a comment on one of your photos, click the link below to read and reply to it.\n";
$mail_body .= "http://gallery.greatestjournal.com/displayimage.php?pos=-".$pid;
cpg_mail($picture_owner_data['user_email'], $subject, make_clickable($mail_body), 'text/plain', "GJPix", 'dontreply@yourdomain.com');
}
DONT FORGET TO CHANGE $mail_body url to yours as well as $subject and as well cpg_mail info.


then you need to add a new row to the config table, you can use this sql query:
Code: [Select]
INSERT INTO `cpg143_config` ( `name` , `value` )
VALUES (
'email_user_comment_notification', 1
)

and finally find, in lang/englsih.php
Code: [Select]
  array('Notify admin of comments by email', 'email_comment_
and after it add
Code: [Select]
array('Allow users to recieve email when comments are posted', 'email_user_comment_notification', 1),
Logged

fcarentz

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 24
Re: E-Mail Notification To Members On Comments
« Reply #34 on: February 04, 2006, 01:50:43 am »

A search would have revealed a working version of this script that i did back in December.

http://forum.coppermine-gallery.net/index.php?topic=25675.0

Go there and follow the instructions it will support a bridge and your users can set the option to be mailed or not. And it will only mail them once until they view the comments so they don't get spammed with Comment emails.

Hope this helps you.

angeldevil

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 107
Re: E-Mail Notification To Members On Comments
« Reply #35 on: May 09, 2006, 02:55:26 pm »

hi to you,
i tried your code but didn't work for me. i have coppermine version 1.4.4
is there any edit that i might write on your script?
help me, please!
Logged
a

cosmoweb

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: E-Mail Notification To Members On Comments
« Reply #36 on: July 15, 2008, 12:05:49 am »

For coppermine 1.4.18, that's all right?  ::)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: E-Mail Notification To Members On Comments
« Reply #37 on: July 15, 2008, 06:59:48 am »

Should work for all versions of the cpg1.4.x series.
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.039 seconds with 21 queries.