Email users on new comments Email users on new comments
 

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]

Main Menu

Email users on new comments

Started by lurkalot, March 01, 2011, 07:31:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lurkalot

Email users on new comments is a feature that I'd love to see built into coppermine.  Ideal for photographic communities.

I just noticed this post by Andre,  http://forum.coppermine-gallery.net/index.php/topic,70352.msg346215.html#msg346215  And was wondering

1: If this mod will work ok with coppermine bridged with SMF2.
2: Is it configurable. Would my members be able to turn the notifications on, or off.

Any ideas Andre?

Would love someone to make this a stand alone plugin. ;)
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré

Should be quite easy to make it compatible to bridged galleries. If I'd modify the code can you test it for me? Regarding the on/off toggle I think this should too much for a simple mod and should be accomplished by the person who creates the plugin :)

lurkalot

Andre.  Thanks, Sure I'll test it. 

I'll use one of my test sites to check it on first. ;)
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré

Please try the following. Open db_input.php, find
            if ($CONFIG['email_comment_notification'] && !USER_IS_ADMIN ) {
                $mail_body = "<p>" . bb_decode(process_smilies($msg_body, $CONFIG['ecards_more_pic_target'])) . '</p>' . $LINEBREAK .$lang_db_input_php['email_comment_body'] . ' ' . $CONFIG['ecards_more_pic_target'] . (substr($CONFIG["ecards_more_pic_target"], -1) == '/' ? '' : '/') . $redirect;
                cpg_mail('admin', $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }

and below, add
            $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));
            }

EC

I tested too!. My gallery is phpBB3 bridged. It works apart the title which gives null result.
elena

Αndré

Quote from: EC on March 02, 2011, 12:36:37 PM
the title which gives null result.
Try to replace
$title = $picture[0]['title'] ? $picture[0]['title'] : $picture[0]['filename'];
with
$title = $picture[0]['title'] != '' ? $picture[0]['title'] : $picture[0]['filename'];

EC


Αndré

Please post some information if you expect help:
- Post the content of the received mail
- Post a link to the picture you tested
- Does the picture you're testing with has a title?

EC

I'm sorry. I made a stupid mistake. The first picture I tested has a simple title "...".
I use a picture with a title and your code works, and it returns correctly a message

La tua foto 'Punti di vista' ha ricevuto un nuovo commento. Puoi leggerlo al link seguente http://www.fotonicamente.it/Gallery/displayimage.php?pid=5193


thanks again
elena

lurkalot

Andre, thanks.  Tested and working. 

Shame about users not being able to turn them Off / On though..  I don't think I'll be able to use this mod without.  Some members won't want to get emails.

Believe me, if I had a clue about coding a plug then I would in a flash.  I'll see if one of my coder friends can sort this for me, and report back. ;)
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Stramm

I've ported the modpack version of the notification system some time back. However it's a mod and not a plugin and it's not prepared for posting though. But users can turn on/ off notifications in general and for certain images.

When I'm in coding mood I'll either write some instructions on how to mod your gallery or I'll see if a plugin version will work. But you can't expect from Αndré to code such a featurerich enhancement over night ;)
 

EC


Many features of the mod you did for coppermine 1.4... were very useful. The notification also of comments from other users, the private messagging, the avatar...which worked also in bridged gallery.
Are you going to do such a mod also for the latest version of coppermine?
thanks
elena

Stramm

As far as I've seen a user has ported the PM plugin to 1.5. This I've written as a replacement for the modpack version. I do not know if it'll work as I've not tested it so far.

Avatars... some avatar plugin is around there. Therefore I won't spend any time there (again I do not know neither if that plugin is working nor what it's doing exactly).

A 'modpack' I won't do again. Hopefully a good bunch of the features as plugins.

lurkalot

Quote from: Stramm on March 03, 2011, 09:53:47 AM

When I'm in coding mood I'll either write some instructions on how to mod your gallery or I'll see if a plugin version will work. But you can't expect from Αndré to code such a featurerich enhancement over night ;)
 

Stramm, thanks that would be great.  A plugin just containing the "Email users on new comments" mod, and a on / off check box, so my members can choose would be fantastic.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

EC

Is there the possibility to notify also commenters and not only the owner about the discussion/comments posted on a photo?
Thanks a lot
Elena

Αndré

Quote from: EC on March 14, 2011, 10:24:05 AM
Is there the possibility to notify also commenters and not only the owner about the discussion/comments posted on a photo?
You can say a big 'Thank you' to jmcreis, who was ready to pay to put this modification to the top on my to-do list :)

Replace my first modification with the following code:
        $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'] != USER_ID) {
            $user_id_array[] = $picture[0]['owner_id'];
        }

        $result = cpg_db_query("SELECT author_id FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid = $pid AND author_id != 0");
        while ($row = mysql_fetch_assoc($result)) {
            if ($row['author_id'] != USER_ID) {
                $user_id_array[] = $row['author_id'];
            }
        }
        mysql_free_result($result);

        if (count($user_id_array)) {
            global $cpg_udb;
            $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;
            $result = cpg_db_query("SELECT ".$cpg_udb->field['email']." AS user_email FROM ".$cpg_udb->usertable." WHERE ".$cpg_udb->field['user_id']." IN (".implode(', ', $user_id_array).")");
            while ($row = mysql_fetch_assoc($result)) {
                cpg_mail($row['user_email'], $lang_db_input_php['email_comment_subject'], make_clickable($mail_body));
            }
            mysql_free_result($result);
        }

EC

Thanks! Thanks a lot to both. It works fine
Elena

cmfa

hi,

that's what I had in mind for quite a while. Is it possible not only the title but also with the Thumbinal to pass in the e-mail?

CMFA

Αndré

There are 2 possibilities to include the thumbnail:
1.) Attach it to the email
2.) Embed the image in the email (= use it directly from your gallery)


Which one do you prefer? Afaik the ecard function just embeds the image, so maybe we should do it here the same way.

cmfa

hi,

yes, as in the e-card would be good.

VG