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 51308 times)

0 Members and 1 Guest are viewing this topic.

peakoverload

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 51
E-Mail Notification To Members On Comments
« on: June 18, 2004, 11:56:49 pm »

I know that people have requested similar things to this in the past but I don't think anyone has requested exactly what I am after (apologies if they have but I couldnt find it).

I run a community site and as such I don't have any private albums so all my members can upload to any of the galleries, vote and comment etc.

What I would love to see is a feature that many other galleries have where the owner of the photo regardless of what user group they are a member of can choose to be e-mailed when their photo is commented on.

This is something many of my members have requested and on several other sites that I am a member of that use other gallery software that has this feature it is very popular.

The way it usually works is very similar to the way it works in a lot of forums that e-mail you when a reply is made to your post. In other words you are presented with a tickbox that says "E-Mail me when someone comments on my photo" when you upload your photo. However you would also need a way of turnng off these reminders as well.

What do you think? Any chance of having this added?
« Last Edit: March 04, 2005, 07:37:25 am by GauGau »
Logged

GGallery

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 61
Re: E-Mail Notification To Members On Comments
« Reply #1 on: June 23, 2004, 08:12:08 pm »

I just hacked something together... just for YOU!

(needs to be in db_input in the  case 'comment': section at around line 145 after the             if ($CONFIG['email_comment_notification']) { ... } )


Code: [Select]
           // 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);
            if (mysql_num_rows($result)) {
              $picture_owner_data = mysql_fetch_array($result);
              $subject = "New GJPix Comment by ".USER_NAME;
              $mail_body  = "Hi ".$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');

            }


Of course the language should be extracted and put into the lang/ files... but it works as a quick hack.

Moderators: I tried to add that to the mod forum but there's no 'new topic' button anymore for me.

ADDED: the mod above _always_ sends notifications - you would need to add some field to your user table or lookup a forum table to note/check if the users wants to get notified (with hundreds of spam messages every day they usually don't mind :)
« Last Edit: June 23, 2004, 08:18:11 pm by GGallery »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: E-Mail Notification To Members On Comments
« Reply #2 on: June 24, 2004, 12:01:08 am »

we won't allow "regular users" to create new threads on the mods board, because it would soon be flooded with mod requests instead of actual mods (people just don't read board topics). You were right to post here, I'll move the thread to the mods board for you.

GauGau

P.S. Changed your status to "contributor"  ;)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: E-Mail Notification To Members On Comments
« Reply #3 on: June 24, 2004, 12:10:10 am »

A nice first step, but to include this into the mainstream release, the option has to be admin settable (not so hard, just an additional entry in cpg_config and a plain if/then switch in front of your code) and has to be switched on/off by the individual user as well, as some active users won't like to get flooded with emails, while others will like the option. The main issue here is bbs integration: it'll be easy to add an option to the regular coppermine profile page, but it's impossible to add it to the profile if coppermine get's bridged. As a workaround, this could be an additional entry in the user admin menu labelled "notification" where the user could switch this on/off outside of the profile (the question remains: where do you store this data?).
Would be very nice if you could come up with an elegant solution for this issue.

GauGau
Logged

GGallery

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 61
Re: E-Mail Notification To Members On Comments
« Reply #4 on: July 01, 2004, 04:40:40 am »

I think I would provide the switch to the user in profile.php that's where it belongs to
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: E-Mail Notification To Members On Comments
« Reply #5 on: July 01, 2004, 07:40:00 am »

sure, I wasn't making this clear, sorry: one switch for the admin (enable eMail notification on comments - YES/NO) in coppermine config, one for each user in profile.php (that only turns up if the admin has enabled this feature in coppermine config). Reason: there are users (coppermine site admins) who like their version of coppermine to keep exactly the same features as the old version when upgrading, so we decided all new features must have an admin switch.

GauGau
Logged

peakoverload

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 51
Re: E-Mail Notification To Members On Comments
« Reply #6 on: July 26, 2004, 12:10:47 am »

Just wanted to say a big thank you for coming up with this code!!!

Sorry I didnt reply before but I only just refound this thread (I got side tracked with another issue and forgot about this thread  ::) )

I shall try out this mod in the next couple of days and feed back the results.
Logged

Allo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: E-Mail Notification To Members On Comments
« Reply #7 on: August 18, 2004, 06:26:13 am »

Nice work. But i have a question:
Will this feature slow down the server ? I think yes.
I was looking for a similar feature and i realized that the best solution to alert an user of a comment is to create a page where to show the alert of the comments like in www.deviantart.com. This will be not an hard work for the server.
Logged

willemt

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: E-Mail Notification To Members On Comments
« Reply #8 on: March 02, 2005, 06:10:35 am »

Hello,

First thanks a lot for the code you shared with the board. I have a problem implementing it though ???: Getting an error everytime somebody posts a comment:
"There was an error while processing a database query".  :-\\
Could it be related to the fact that I integrated coppermine into a phpbb board and that the db query in your code should be modified because of this? (I did follow the documentation to bridge between the two).

I am really new to sql stuff and did not mess arround with it so fare...
Thanks for your ideas!!

Willem.

I just hacked something together... just for YOU!

(needs to be in db_input in the  case 'comment': section at around line 145 after the             if ($CONFIG['email_comment_notification']) { ... } )


Code: [Select]
           // 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);
            if (mysql_num_rows($result)) {
              $picture_owner_data = mysql_fetch_array($result);
              $subject = "New GJPix Comment by ".USER_NAME;
              $mail_body  = "Hi ".$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');

            }


Of course the language should be extracted and put into the lang/ files... but it works as a quick hack.

Moderators: I tried to add that to the mod forum but there's no 'new topic' button anymore for me.

ADDED: the mod above _always_ sends notifications - you would need to add some field to your user table or lookup a forum table to note/check if the users wants to get notified (with hundreds of spam messages every day they usually don't mind :)

Logged

RatKing

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
    • Personal website
Re: E-Mail Notification To Members On Comments
« Reply #9 on: March 02, 2005, 11:28:27 am »

The error you are getting is because your CPG_CONFIG table does most likely not have a field called: email_comment_notification

So go to your database add this record to your CPG_CONFIG table and the message will be gone. To have the mails send out set the value (second colum in the database) to 'true' and the mails will be send.

If I have some time I'll see if I can write a bit clearer story about how to do this. It's quite simple actualy the only problem is that the writter (GGalery) assumed quite a bit of knowledge on how CPG works internaly the side of the readers.
Logged

Nibbler

  • Guest
Re: E-Mail Notification To Members On Comments
« Reply #10 on: March 02, 2005, 12:08:13 pm »

This mod will not work with a bridged install. You would need to rewrite that query to pull the data from the correct table, or find some workaround to get the info some other means.
Logged

willemt

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: E-Mail Notification To Members On Comments
« Reply #11 on: March 02, 2005, 04:48:49 pm »

Hi Ratking,

Thanks a lot for steering me in the right direction, I will give it a try later today!

regards,
Willem.

The error you are getting is because your CPG_CONFIG table does most likely not have a field called: email_comment_notification

So go to your database add this record to your CPG_CONFIG table and the message will be gone. To have the mails send out set the value (second colum in the database) to 'true' and the mails will be send.

If I have some time I'll see if I can write a bit clearer story about how to do this. It's quite simple actualy the only problem is that the writter (GGalery) assumed quite a bit of knowledge on how CPG works internaly the side of the readers.
Logged

willemt

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: E-Mail Notification To Members On Comments
« Reply #12 on: March 02, 2005, 04:59:34 pm »

Anybody who moded this mod  ::) to work on a bridged installation?

thanks!!

Willem.

This mod will not work with a bridged install. You would need to rewrite that query to pull the data from the correct table, or find some workaround to get the info some other means.
Logged

Nibbler

  • Guest
Re: E-Mail Notification To Members On Comments
« Reply #13 on: March 03, 2005, 05:23:45 pm »

You can try using this code instead, I haven't tested it though.

Code: [Select]
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');
« Last Edit: March 04, 2005, 12:35:15 pm by Nibbler »
Logged

willemt

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
WORKS! but...
« Reply #14 on: March 03, 2005, 08:01:02 pm »

... something goes wrong with the if-else check: the else part is executed not matter what. So I just removed the if-else and call the if-part directly without doing the check.

And it works great!  ;D

Thanks a lot,

Willem.
Logged

Nibbler

  • Guest
Re: E-Mail Notification To Members On Comments
« Reply #15 on: March 04, 2005, 12:36:22 pm »

Probably needs quotes around the UDB_INTEGRATION - original post so edited.
Logged

TerryG

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 45
Re: E-Mail Notification To Members On Comments
« Reply #16 on: April 02, 2005, 10:44:45 pm »

Hey,

Just thought I would point out a potential gotcha -- put this block before  "if (!USER_ID)"  in db_input.php

I put the new code within the THEN clause, and was hitting mostly the ELSE.  d'oh!
Logged

nanothree

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

Another suggestion would be to stop emails form being sent when a user comments on their own image.
« Last Edit: April 10, 2005, 01:15:57 pm by nanothree »
Logged

nanothree

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

i am getting an error, it doenst say what it is though it just has the error box and no text in, so i turned on debug mode and all that appears in the box is:
 File: /home/liam/public_html/Gallery/bridge/phpbb.inc.php - Line: 277
Logged

Nibbler

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

That means it couldn't find the user in the database when it did the udb_get_user_infos().
Logged
Pages: [1] 2   Go Up
 

Page created in 0.039 seconds with 20 queries.