Email for favorites Email for favorites
 

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 for favorites

Started by heavensportal, September 12, 2015, 11:44:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

heavensportal

I think this has been asked of in prior versions but can't find it, sorry.

I have been asked by many members if there is a way to get notified when they chose an image as favorite:

1. To be able to get a notification that it was successfully added to their favorites vs just sending them back to home page

2. To be able to choose a favorite artist not just image and get email notification when that artist has a new upload

I told them I would ask you.

Thank you in advance

Αndré

Quote from: heavensportal on September 12, 2015, 11:44:13 PM
1. To be able to get a notification that it was successfully added to their favorites vs just sending them back to home page
Intended behavior is, that they'll stay on the same page. This bug has already been fixed in our SVN repository. Do you still need/want to send email when adding a favorite?


Quote from: heavensportal on September 12, 2015, 11:44:13 PM
2. To be able to choose a favorite artist not just image and get email notification when that artist has a new upload
How do you choose a favorite artist? Automatically, basing on the pictures you have currently added to your favorites?

heavensportal

Quote from: Αndré on September 14, 2015, 10:17:50 AM
Intended behavior is, that they'll stay on the same page. This bug has already been fixed in our SVN repository. Do you still need/want to send email when adding a favorite?

How do you choose a favorite artist? Automatically, basing on the pictures you have currently added to your favorites?

If there could be an email to the artist (member) that they have been added as a favorite by someone then that would be great---I am sure it is something that a lot of users would like.

If not then at least a message stack that says the image was successfully added to favorites wold be great.

Well the way that the favorites right now are chosen is on a per image basis, as you already know. To add an artist/member to favorites would be great and that is done by maybe a click on the member name then a drop list for add to favorites or is it called a contextual menu like when you right click something on the computer.


Αndré

Summary:

  • Add message that picture was successfully added to/removed from favorites
  • Add artists to favorites
  • Send email to artist when he has been added to someones favorites
  • Send email to users if artist uploads new pictures

Honestly, there's some effort needed to complete all features. I'll have a look if I can solve the first point soon. I doubt I'll have enough spare time to finish the rest.


heavensportal

It is nothing that needs to be done all at once or immediately.

Those I guess could be a wish list?

But I really would like to have the confirmation of the favorite image being added to their "My Favorites". area

Αndré

Because there aren't appropriate language strings, this is what comes closest to what I had in mind:
Index: addfav.php
===================================================================
--- addfav.php (revision 8813)
+++ addfav.php (working copy)
@@ -17,6 +17,7 @@

define('IN_COPPERMINE', true);
define('RATEPIC_PHP', true);
+define('DISPLAYIMAGE_PHP', true);

require('include/init.inc.php');

@@ -39,9 +40,13 @@
// See if this picture is already present in the array
if (!in_array($pid, $FAVPICS)) {
     $FAVPICS[] = $pid;
+    $message_id = cpgStoreTempMessage($lang_picinfo['addFav']);
+    $message_icon = 'success';
} else {
     $key = array_search($pid, $FAVPICS);
     unset($FAVPICS[$key]);
+    $message_id = cpgStoreTempMessage($lang_picinfo['remFav']);
+    $message_icon = 'info';
}

// Adjust redirect for "My Favorites" meta album
@@ -99,6 +104,10 @@
     }
}

+$ref = preg_replace('/#.*/', '', $ref);
+$ref .= strpos($ref, '?') ? '&' : '?';
+$ref .= 'message_id='.$message_id.'&message_icon='.$message_icon.'#cpgMessageBlock';
+
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $ref);
pageheader($lang_common['information'], "<meta http-equiv=\"refresh\" content=\"1;url=$ref\">");


Of course you could hard-code appropriate language strings, but I think I'll add a new plugin hook and create a plugin which implements the feature properly.

heavensportal

This -- as you always do-- should work until you hook it into the next update. Thank you

Do I add it to a file or create a new .php for it in root?

Αndré

Added hidden feature to display confirmation message when adding/removing pictures to/from favorites in SVN revision 8815 (will be part of cpg1.5.40).
Updated hidden features plugin in SVN revision 8816 (version 1.5).

To add the functionality in earlier versions than cpg1.5.40, open addfav.php, find
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
and above, add
// Prepare message
if (function_exists('hidden_features_page_start')) {
    if (in_array($pid, $FAVPICS)) {
        $message_id = cpgStoreTempMessage($lang_plugin_hidden_features['fav_added']);
        $message_icon = 'success';
    } else {
        $message_id = cpgStoreTempMessage($lang_plugin_hidden_features['fav_removed']);
        $message_icon = 'info';
    }
    $ref .= strpos($ref, '?') !== FALSE ? '&' : '?';
    $ref .= 'message_id='.$message_id.'&message_icon='.$message_icon.'#cpgMessageBlock';
}


Additionally, you have to install version 1.5 or higher of the hidden features plugin.

heavensportal

Quote from: Αndré on September 16, 2015, 12:20:17 PM
Added hidden feature to display confirmation message when adding/removing pictures to/from favorites in SVN revision 8815 (will be part of cpg1.5.40).
Updated hidden features plugin in SVN revision 8816 (version 1.5).

To add the functionality in earlier versions than cpg1.5.40, open addfav.php, find
$header_location = (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE'))) ? 'Refresh: 0; URL=' : 'Location: ';
and above, add
// Prepare message
if (function_exists('hidden_features_page_start')) {
    if (in_array($pid, $FAVPICS)) {
        $message_id = cpgStoreTempMessage($lang_plugin_hidden_features['fav_added']);
        $message_icon = 'success';
    } else {
        $message_id = cpgStoreTempMessage($lang_plugin_hidden_features['fav_removed']);
        $message_icon = 'info';
    }
    $ref .= strpos($ref, '?') !== FALSE ? '&' : '?';
    $ref .= 'message_id='.$message_id.'&message_icon='.$message_icon.'#cpgMessageBlock';
}


Additionally, you have to install version 1.5 or higher of the hidden features plugin.

OK have added the code then added the plugin and YAY!!  It shows a notification bar that it was successfully added to favorites  when it pops back to the front page after adding it.

Thank you so very much. And as I said the others are a wish for if/when possible.