I have a couple of users setup to receive an email when an item it added to my main "home" album. When I add a new album to it (with pictures in it), no email is sent. I did an email test from gallery and it was able to send that test email to one of the users. I did not think there was much configuration to get this module setup, but maybe I am missing something.
Gallery version 2.3
PHP version 4.3.11 cgi-fcgi
Webserver Apache
Database mysqlt 5.0.67-log
Toolkits ImageMagick, Gd
Operating system Linux linhost218.prod.mesa1.secureserver.net 2.4.21-53.ELsmp #1 SMP Wed Nov 14 03:54:12 EST 2007 i686
Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
Link to php info:
http://mylesjay.com/info.php
Any help would be appreciated.
Posts: 113
I've been having the same problem since upgrading from 2.2.5 to 2.3. Everything seems to be set up correct, test e-mails work from Site Admin, but no messages are sent when items are added to an album being watched.
Gallery version = 2.3 core 1.3.0
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.4-2ubuntu5.3 apache2handler
Webserver = Apache
Database = mysqli 5.0.51a-3ubuntu5.1, lock.system=flock
Toolkits = ArchiveUpload, Exif, Ffmpeg, ImageMagick, Thumbnail, NetPBM
Posts: 41
That is when it started for me as well. Hopefully someone will be able to help. If more information is needed, or if an Admin wants me to do any testing, please let me know.
Gallery version 2.3
PHP version 4.3.11 cgi-fcgi
Webserver Apache
Database mysqlt 5.0.67-log
Toolkits ImageMagick, Gd
Operating system Linux
Browser Firefox 3.0.3
Link to [url= http://mylesjay.com/info.php]php info[/url]
Posts: 113
I put my Gallery in debug mode to see if I could figure out what's going on. It looks like the module loads just fine. I'm wondering if this is the problem: I see it selecting from g2_SubscriptionMap (presumably to determine which notifications to send and to whom). But when I do a 'select * from g2_SubscriptionMap' in mySQL, I get 0 rows.
Posts: 27300
Uninstall the module, delete the folder from the file system. Reinstall the module via downloadable plugins.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 113
No change after uninstalling, deleting, re-installing.
I was mistaken before, there are rows in my g2_SubscriptionMap table. Still no e-mails being sent though. Any other debug/tracing info I can provide?
Posts: 113
Update: it might only be the Add Item notification event that's broken. I tried adding the "Delete Entity" event and got the e-mail notification just fine.
Posts: 41
Same for me all around. I tried uninstalling and deleting the folder than re-installing and it still does not work. Also, I setup a notification for comments and that worked fine, but still will not work for added items.
Another thing I noticed was that I tried to uncheck the "Apply to Subitems" box for the added items function and when I press save, the box rechecks itself. It seems that you are not able to not include subitems to watch for added items. Not sure if this is related, or intentional, but thought I would bring it up.
Posts: 27300
Please file a bug report on this:
https://sourceforge.net/tracker/?atid=107130&group_id=7130&func=browse
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 113
Done.
https://sourceforge.net/tracker2/?func=detail&aid=2245033&group_id=7130&atid=107130
Posts: 10
Hi,
Same problem for me. The notification system does not work for new items added to a watched album.
"Album structure change event" works fine when you add items. A way to be notify if you need.
Humm, another question : is there any solution to avoid receiving one email per item added? Only one would be enough !
In any case, this is a great "module" ! Very usefull.
Laurent
PS : Hey Dave, you are really everywhere on this forum! Each time I make a search, i found the teacher looking at me !
Gallery version = 2.3 noyau 1.3.0
API = Noyau 7.54, Module 3.9, Thème 2.6, Intégré 1.5
PHP version = 5.2.6 cgi
Serveur Web = Apache
Base de données = mysqlt 4.0.27-standard-log, lock.system=flock
Système d'exploitation = Linux infong 2.4 #1 SMP Tue Dec 18 22:34:10 UTC 2007 i686 GNU/Linux
Posts: 22
Hi,
Just wondering if anyone has had any luck figuring this out? I have a seasonal gallery (gathering snowcamping pictures for a sierra club group), so I didn't realize the functionality that was lost during the upgrade, until early this year when the gallery started getting used again. I noticed that the album structure change events still work (receive emails for those), but at this point the gallery is large enough that having to figure out which album it was that actually changed when someone uploads new pictures is a real hassle... Tried deleting and re-downloading the module, no luck.
Thanks,
Mark
Posts: 113
There's a partial patch attached to my bug report. It's not a complete fix, but it does get the basic notification working again.
Posts: 22
Thanks for the tip, I appreciate it! I missed that initially when looking at the bug report - Made the change, and notifications for added items are working again.
Mark
Posts: 41
Would someone be able to explain to me how to add the patch that is on the bug? I see that something needs to be changed in the GalleryCoreEventNotifications.class file, but I don't really understand what the change is that needs to be made, or where in the file to make the change.
Thanks for the help!
Posts: 113
Assuming you're on Linux, save the patch under gallery2/modules/notification/classes (like patch.txt) and then use the patch command:
$ patch GalleryCoreEventNotifications.class patch.txt
(make a backup of the .class file first, just in case)
Posts: 41
I tried this and I just get a message that says "***malformed patch at line 6 : */" Any ideas what the problem could be?
Thanks again!
Posts: 113
Something's wrong with that patch file, I'm not sure what (I'm no expert on diffs).
Anyway, you can make these changes manually to the GalleryCoreEventNotifications.class file:
Replace this line:
return count($data) == 1 ? $data[0]->getId() : $data[0]->getParentId();
with this:
return $data[0]->getParentId();
and then remove this line:
return count($data) == 1 ? $data[0]->getId() : $data[0]->getParentId();
So basically the getItemID() function should look like this:
function getItemId() {
$data = $this->_event->getData();
return $data[0]->getParentId();
}
Again, this is just a band-aid. It's working for me, but YMMV.
Posts: 41
Thanks for the help, but for some reason this is still not working for me. There are three places in the class file that seem to have the getItemId() function, so maybe I am making this change in the wrong place. Here is what my file looks like... can you tell if I did something wrong?
<?php
/*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2008 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
GalleryCoreApi::requireOnce('modules/notification/classes/NotificationEvent_1_0.class');
/**
* This is the container for information about the events defined in the core package
* @package Notification
* @subpackage Classes
* @author Tim Almdal <tnalmdal@shaw.ca>
* @version $Revision: 18133 $
*/
class ActivatePluginNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Plugin Activation Event'));
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
return $this->_translateText('notification', array('arg1' => $this->getPluginType(),
'arg2' => $this->getPlugin(),
'text' => $gallery->i18n('The %s %s was activated')));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::ActivatePlugin');
}
/**
* @see NotificationEvent_1_0::isGlobal
*/
function isGlobal() {
return true;
}
/**
* Get the plugin id of the activated plugin
*
* @return string The plugin id of the activated plugin
*/
function getPlugin() {
$data = $this->_event->getData();
return $data['pluginId'];
}
/**
* Get the plugin type of the activated plugin
*
* @return string The plugin type of the activated plugin
*/
function getPluginType() {
$data = $this->_event->getData();
return $data['pluginType'];
}
}
class DeactivatePluginNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Plugin Deactivation Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::DeactivatePlugin');
}
/**
* @see NotificationEvent_1_0::isGlobal
*/
function isGlobal() {
return true;
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
return $this->_translateText('notification', array('arg1' => $this->getPluginType(),
'arg2' => $this->getPlugin(),
'text' => $gallery->i18n('The %s %s was deactivated')));
}
/**
* Get the plugin id of the deactivated plugin
*
* @return string The plugin id of the deactivated plugin
*/
function getPlugin() {
$data = $this->_event->getData();
return $data['pluginId'];
}
/**
* Get the plugin type of the activated plugin
*
* @return string The plugin type of the activated plugin
*/
function getPluginType() {
$data = $this->_event->getData();
return $data['pluginType'];
}
}
class ErrorNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Error Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::Error');
}
/**
* @see NotificationEvent_1_0::isGlobal
*/
function isGlobal() {
return true;
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
$error = $this->getError();
return array(null, $error->getAsText());
}
/**
* Return the Gallery Status Object encapsulated in this event.
*
* @return object GalleryStatus
*/
function getError() {
$data = $this->_event->getData();
return $data['error'];
}
}
class ItemOrderNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Item Order Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::ItemOrder');
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
list ($ret, $item) = GalleryCoreApi::loadEntitiesById($this->getItemId(), 'GalleryItem');
if ($ret) {
return array($ret, null);
}
$title = GalleryUtilities::markup($item->getTitle(), 'strip');
return $this->_translateText('notification', array('arg1' => $title,
'text' => $gallery->i18n('The child items for %s have been reordered.')));
}
/**
* @see NotificationEvent_1_0::getPermission
*/
function getPermission() {
return 'core.view';
}
/**
* @see NotificationEvent_1_0::getItemId
*/
function getItemId() {
return (int)$this->_event->getData();
}
/**
* @see NotificationEvent_1_0::isAppropriateForItem
*/
function isAppropriateForItem($item) {
return empty($item) ? false : GalleryUtilities::isA($item, 'GalleryItem');
}
}
class LoginNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('User Login Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::Login', 'entityType' => 'GalleryUser');
}
/**
* @see NotificationEvent_1_0::isGlobal
*/
function isGlobal() {
return true;
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
$user = $this->getUser();
return $this->_translateText('notification', array('arg1' => $user->getUserName(),
'text' => $gallery->i18n('User %s has logged in.')));
}
/**
* Return the User entity which just logged on.
* @return object GalleryUser
*/
function getUser() {
return $this->_event->getEntity();
}
}
class FailedLoginNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('User Login Failed Event'));
}
/**
* @see NotificationEvent_1_0::isGlobal
*/
function isGlobal() {
return true;
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::FailedLogin');
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
return $this->_translateText('notification', array('arg1' => $this->getUserName(),
'text' => $gallery->i18n('User %s login failed.')));
}
/**
* Get the userName that failed to login
*
* @return string The userName that failed to login
*/
function getUserName() {
$data = $this->_event->getData();
return $data['userName'];
}
}
class LogoutNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('User Logout Event'));
}
/**
* @see NotificationEvent_1_0::isGlobal
*/
function isGlobal() {
return true;
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::Logout', 'entityType' => 'GalleryUser');
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
$user = $this->getUser();
return $this->_translateText('notification', array('arg1' => $user->getUserName(),
'text' => $gallery->i18n('User %s has logged out.')));
}
/**
* Return the User entity which just logged off.
* @return object GalleryUser
*/
function getUser() {
return $this->_event->getEntity();
}
}
class RemovePermissionNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Permission Removed Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::RemovePermission');
}
/**
* @see NotificationEvent_1_0::getItemId
*/
function getItemId() {
$data = $this->_event->getData();
$itemIds = array_keys($data['itemIdsAndBits']);
return $itemIds[0];
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
$data = $this->_event->getData();
/** @todo: Fix the below message for i18n (%d instead of %s, plural form). */
return $this->_translateText('notification',
array('arg1' => count($data['itemIdsAndBits']),
'text' => $gallery->i18n('Permission Change on %s items.')));
}
/**
* @see NotificationEvent_1_0::getPermission
*/
function getPermission() {
return 'core.changePermissions';
}
}
class UninstallPluginNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Plugin Uninstalled Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::UninstallPlugin');
}
/**
* @see NotificationEvent_1_0::isGlobal
*/
function isGlobal() {
return true;
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
return $this->_translateText('notification', array('arg1' => $this->getPluginType(),
'arg2' => $this->getPlugin(),
'text' => $gallery->i18n('The %s %s was uninstalled')));
}
/**
* Get the plugin id of the deactivated plugin
*
* @return string The plugin id of the deactivated plugin
*/
function getPlugin() {
$data = $this->_event->getData();
return $data['pluginId'];
}
/**
* Get the plugin type of the activated plugin
*
* @return string The plugin type of the activated plugin
*/
function getPluginType() {
$data = $this->_event->getData();
return $data['pluginType'];
}
}
class AlbumStructureChangeNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification',
$gallery->i18n('Album Structure Change Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::ViewableTreeChange');
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
return $this->_translateText('notification',
$gallery->i18n('Viewable Tree Change Event Occurred'));
}
/**
* @see NotificationEvent_1_0::getPermission
*/
function getPermission() {
return 'core.view';
}
/**
* @see NotificationEvent_1_0::getItemId
*/
function getItemId() {
$data = $this->_event->getData();
return $data['itemId'];
}
/**
* @see NotificationEvent_1_0::isAppropriateForItem
*/
function isAppropriateForItem($item) {
return empty($item) ? false : GalleryUtilities::isA($item, 'GalleryItem');
}
}
class SaveNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Entity Saved Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'GalleryEntity::save', 'entityType' => 'GalleryItem');
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
$entity = $this->_event->getEntity();
return $this->_translateText('notification', array('arg1' => $entity->getTitle(),
'text' => $gallery->i18n('%s was saved')));
}
/**
* @see NotificationEvent_1_0::getItemId
*/
function getItemId() {
$entity = $this->_event->getEntity();
return $entity->getId();
}
/**
* @see NotificationEvent_1_0::getPermission
*/
function getPermission() {
return 'core.view';
}
/**
* @see NotificationEvent_1_0::isAppropriateForItem
*/
function isAppropriateForItem($item) {
return empty($item) ? false : GalleryUtilities::isA($item, 'GalleryItem');
}
}
class DeleteNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Entity Deleted Event'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'GalleryEntity::delete', 'entityType' => 'GalleryItem');
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
$entity = $this->_event->getEntity();
return $this->_translateText('notification', array('arg1' =>$entity->getTitle(),
'text' => $gallery->i18n('%s was deleted')));
}
/**
* @see NotificationEvent_1_0::getItemId
*/
function getItemId() {
$entity = $this->_event->getEntity();
return $entity->getId();
}
/**
* @see NotificationEvent_1_0::getPermission
*/
function getPermission() {
return 'core.view';
}
/**
* @see NotificationEvent_1_0::isAppropriateForItem
*/
function isAppropriateForItem($item) {
return empty($item) ? false : GalleryUtilities::isA($item, 'GalleryItem');
}
}
class ItemAddedNotification extends NotificationEvent_1_0 {
/**
* @see NotificationEvent_1_0::getDescription.
*/
function getDescription() {
global $gallery;
return $this->_translateText('notification', $gallery->i18n('Item Added'));
}
/**
* @see NotificationEvent_1_0::getEventSpecs
*/
function getEventSpecs() {
return array('eventName' => 'Gallery::itemAdded');
}
/**
* @see NotificationEvent_1_0::getNotificationMessage.
*/
function getNotificationMessage() {
global $gallery;
$items = $this->_event->getData();
/* How should we handle what type it is and where to link? */
$parentId = $items[0]->getParentId();
$itemCount = count($items);
if ($itemCount == 1) {
/* One item, call it what it is and link to it directly */
$itemTypeName = $items[0]->itemTypeName();
$itemTypeName = $itemTypeName[1];
$itemId = $items[0]->getId();
} else {
/* Many items, link to the parent */
$itemId = $parentId;
$itemTypes = array();
foreach ($items as $item) {
$itemTypeName = $item->itemTypeName();
$itemTypeName = $itemTypeName[1];
$itemTypes[$itemTypeName] = empty($itemTypes[$itemTypeName]) ? 1
: $itemTypes[$itemTypeName]++;
}
/* Call it all of the items */
if (count($itemTypes) == 1) {
$itemTypeNames = array_keys($itemTypes);
} else {
$itemTypeNames = implode(', ', array_keys($itemTypes));
}
}
/* Get the URL to the item the event was triggered on */
$urlGenerator =& $gallery->getUrlGenerator();
$parentUrl = $urlGenerator->generateUrl(array('view' => 'core.ShowItem',
'itemId' => $itemId),
array('forceFullUrl' => true,
'forceSessionId' => false,
'htmlEntities' => false));
return $this->_translateText('notification', array('arg1' => $itemTypeName,
'arg2' => $parentUrl, 'text' =>
$gallery->i18n("A new %s has been added. To view it, click here: \n%s")));
}
/**
* @see NotificationEvent_1_0::getPermission
*/
function getPermission() {
return 'core.view';
}
/**
* @see NotificationEvent_1_0::getItemId
*/
function getItemId() {
$data = $this->_event->getData();
return $data[0]->getParentId();
}
/**
* @see NotificationEvent_1_0::isAppropriateForItem
*/
function isAppropriateForItem($item) {
return empty($item) ? false
: GalleryUtilities::isA($item, 'GalleryItem') && $item->getCanContainChildren();
}
}
?>
Posts: 113
In my file, it's the function getItemId() that starts on line 706.
Posts: 41
That is the one I changed... I guess it just didn't work for me. Oh well. I hope that a real fix for this module comes out soon!
Posts: 16
is there a fix for this yet guys ?
Posts: 17
I have tried to edit the file. But then something strange is happening, i only get an notification when it's an administrator that adds an item.
The same thing is happening with the Login Event notification, it's only sending email when its an admin that logs in. Any of you seen this?
Gallery version = 2.3.1 core 1.3.0.1
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.3 isapi
Webserver = Microsoft-IIS/6.0
Database = mysqlt 5.0.45-community-nt, lock.system=database
Toolkits = LinkItemToolkit, Thumbnail, Exif, ArchiveUpload, Ffmpeg, ImageMagick, NetPBM
Acceleration = none/0, full/900
Operating system = Windows NT SERVER 5.2 build 3790
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB6.3; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0)
Posts: 3
Any news from that problem ?
Posts: 3
Mmm, the problem is that when notification is not set to public, it doesn't work when a normal registered user post something. So it should be changed because we might one this feature only available for admin but working when registered users post something.
My 2 cents.