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: comment notification mod  (Read 4804 times)

0 Members and 1 Guest are viewing this topic.

bitcloud

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 117
comment notification mod
« on: April 13, 2007, 01:16:07 am »

Hey Stramm...

No one else seems to be talking about it, but i'm looking for a way to display a "New Unread Comments" and "New Private Messages" in the header.

I'm trying to mod a copy of "subcribtion_manage.php" to display only subscribed posts which contain unread comments. First I've gotta get it displaying the number of comments on each post, and somehow have it store this information for the user (I haven't even thought of how to do this yet. I'm not looking forward to the task :)

Every other mod i've seen relating to this issue is about email notifications. Do you have any plan or inclination to try and implement such a comment notification mod? Can you offer any pointers on this?

Cheers
Lachlan
« Last Edit: April 22, 2007, 07:00:35 pm by Stramm »
Logged

bitcloud

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 117
comment notification mod
« Reply #1 on: April 13, 2007, 01:17:55 am »

Sorry, obviously the "New Private Message" bit is already covered by your mod pack, so it's really the "new comments" i'm looking to include
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: comment notification mod
« Reply #2 on: April 13, 2007, 07:28:04 am »

To display the (total) number of comments on a specific pic would mean you need to edit the actual query and join the comments table. Then that's two joins (pictures, notify and comments table). I'd say that can put a lot of heat on your server if you have a lot of comments and users using that feature.

To display the number of comments after the user subscribed to some pic (and or the last time he visited it after subscribing) you'll need to save the comment id to the notify table (create that new entry in the db first). That would mean a lot of editing put it's possible

To just show the pics with unread comments in the subscription manager is simple. You add to the query that you do want to show only pics with mail_sent = 1. Every time a user adds a comment, subscribed users will get an email once, the mentioned fiels got set to 1. If he visits the pic, mail_sent gets set to 0

-> change
Code: [Select]
" FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_NOTIFY']} AS u ON pid=u.picture_id WHERE  u.user_id=".(USER_ID).to
Code: [Select]
" FROM {$CONFIG['TABLE_PICTURES']} AS p INNER JOIN {$CONFIG['TABLE_NOTIFY']} AS u ON pid=u.picture_id WHERE u.mail_sent=1 AND u.user_id=".(USER_ID).
and to make the counts fit
Code: [Select]
$result = cpg_db_query("SELECT count(*) FROM  {$CONFIG['TABLE_NOTIFY']} WHERE user_id=".(USER_ID));to
Code: [Select]
$result = cpg_db_query("SELECT count(*) FROM  {$CONFIG['TABLE_NOTIFY']} WHERE mail_sent=1 AND user_id=".(USER_ID));

bitcloud

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 117
Re: comment notification mod
« Reply #3 on: April 13, 2007, 09:30:35 am »

jees! really?
thats brilliant.

I guess the only other thing to resolve now is to somehow not display files that a user has uploaded themselves (until they have been commented on)
As it is, it displays new commented threads perfectly (!) but also displays uncommented user-owned uploads... (so a user wouldn't know if a self published image had been commented on as they appear to begin with)

thanks heaps for the help so far... if there are any clues as to how to achieve this you could offer that would pretty much solve this one for me...
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: comment notification mod
« Reply #4 on: April 17, 2007, 06:43:20 pm »

That's a setting in the user profile... 'auto subscribe to pictures you uploaded' (or something like that I named it I think)

bitcloud

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 117
Re: comment notification mod
« Reply #5 on: April 18, 2007, 05:06:55 am »

I was hoping i could do some kind of:

Code: [Select]
if ($number_of_comments > 0) {
if ($commenter_uid != $currentuser_uid) {
displaythumbnail;
}
}

That sort of check so that nothing will show until there's atleast 1 comment posted (by someone other than the current user) - that way it won't affect email notifications. Can i pull comment numbers or comment owner uid's out from within subcribtion_manage.php?
Logged

bitcloud

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 117
Re: comment notification mod
« Reply #6 on: April 22, 2007, 04:37:43 pm »

Actually, I don't know what I was doing before, but it seems to work now without any additional modifications (maybe some old subscriptions were entered into the database differently or something)

anyway thanks so much stramm... you've been so much help. I'll try and outline my full comment notification mod here sometime in the near future (after I do some bug testing etc)
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: comment notification mod
« Reply #7 on: April 22, 2007, 07:00:20 pm »

k, looking forward to your contribution ;)

PS: maybe it's cause you didn't work with the 'fixed' subscribtion manage
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 21 queries.