Email notification of new comments

crazyknicksfan
crazyknicksfan's picture

Joined: 2003-01-09
Posts: 32
Posted: Mon, 2005-04-25 14:44

Hi everyone,

I was just wondering if there are any plans currently to add a feature that would allow users to have gallery email them whenever someone leaves a comment in their album. This would be very useful for helping to keep users returning to the site so they would be interested in posting more pictures. Sometimes people tend to forget and then the gallery albums basically become stagnant. Just a thought, I guess. Dunno if this has already been suggested but I think probably yes. Hopefully it will be possible in the next installment of gallery2.

-Thanks

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-04-25 17:10

we'll gladly provide guidance to anyone who wants to work on an email notification module... we don't have the resources to work on it now.

 
stoffer
stoffer's picture

Joined: 2005-02-10
Posts: 75
Posted: Tue, 2005-04-26 17:07

Ahhh, an email notification module would be awesome. :)

I envision a module where the user can get an email when some of the albums are updated with new photos or comments. It could also entail a newsletter of sorts.

Sorry I can't help with any coding at all, but I just wanted to shown that it would be a great addition down the road.

 
jeffchau

Joined: 2005-04-22
Posts: 18
Posted: Fri, 2005-04-29 04:30

It's not necessary to write a module. I think that it should be a comment module enhancement instead.

If you don't need fancy stuff, such as customizing email message in site admin, the following bit of code will do. This simple bit of code will e-mail to the album owner once the comment is added.

But can anyone help me? I dunno how to get the URL from an items using CoreApi

Add them inside the handleRequest method of AddComment.inc,

$ownerId = $item->getOwnerId();

list ($ret, $owner) = GalleryCoreApi::loadEntitiesById($ownerId);

if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

$emailSubj = 'Comment has been added.';
$emailContent = $form['subject'].'<br>'.$form['comment'];
$from = 'youremail';

mail($owner->getEmail(),$emailSubj,$emailContent,"From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-04-29 05:40

that certainly works, but it may be nicer in the long run to centralize email notifications.. make an event for anything we may want to send email about and then the email notification module can listen for those events and send email for anything that has been configured. then in site admin you could say things like: email all site administrators when a new album is created, email the item owner when a comment is added, etc.

 
haggis
haggis's picture

Joined: 2004-05-27
Posts: 17
Posted: Mon, 2005-05-09 13:28
mindless wrote:
we'll gladly provide guidance to anyone who wants to work on an email notification module... we don't have the resources to work on it now.

Note: This also refers to http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=30011

Ultimately you be happy you suggested that...if we can get past the toddling stage and onwards to walking :D
Disclaimer: I'm basically php-clueless (but "enthusiasmful")

OK, I read the module development article in the wiki, and some of it is beginning to make sense. So...off we go I guess.

The Plan
I thought of putting a link in the sidebar - for the logged in user that has added content - which says something like "notify list of new content".
The function of "notify" is shown below, but in short it polls the db to see when last items were added and takes action in the form of predefined notificiation template(s)
I imagine this needs a new table g2_last-poll which contains the last time the "poll and notify' module was fired.

When 'poll/notify' is used, it reads:
1. Last date/time from g2_last-poll (our new table)
2. All timestamps in g2_item (?) > timestamp in g2_last-poll
3. (????) translates this into URL's/albums (????)
4. Reads the URL's into a file, adds text
5. Adds recipients from a list
6. Sends the results to anyone on the recipients list

Am I on the right track here? If not, can anyone suggest a more efficient/robust/logical schema than the this?

Regards & TIA,
-Colin

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-05-10 07:51

We have a simpler mechanism for this. Whenever an item is saved, it generates an event, and you can create module which listens for those events. You can take your own action at that time, whatever action you want.

Look at modules/sizelimit/module.inc for the handleEvent method. It looks for the GalleryEvent::save event meaning that we're saving an item. It then checks to see if the item being saved is a new GalleryAlbumItem, and if it's being newly created then it takes an action.

You can do the same -- create a module that listens for newly created GalleryComment instances and fires off an email to your list of people. Start by creating a new module that just has an event listener that uses GalleryCoreApi::sendTemplatedEmail() to send a test email whenever a comment is added. Once you have that going, we can build on it together.

 
haggis
haggis's picture

Joined: 2004-05-27
Posts: 17
Posted: Tue, 2005-05-10 08:33

Wow
:lol:
I'm....."on it"

I'll report back with a (hopefully) working first version

This is scary and also wildly exciting!! I never envisioned myself working on a Gallery module (or any other darned coding project either, come to think of it!)

 
haggis
haggis's picture

Joined: 2004-05-27
Posts: 17
Posted: Wed, 2005-05-11 21:43

If anyone is interested, I've done a project document outlining goals and scope of the "notify" module.

http://colin.haggis.nl/?page_id=22

 
swordfish
swordfish's picture

Joined: 2004-10-01
Posts: 388
Posted: Thu, 2005-05-19 04:22
haggis wrote:
If anyone is interested, I've done a project document outlining goals and scope of the "notify" module.

http://colin.haggis.nl/?page_id=22

Very cool 8). When you think you have a Alpha or beta version ready I'd be very interested in testing it out.

 
raph

Joined: 2005-02-08
Posts: 6
Posted: Mon, 2005-06-27 14:07

Haggis,

Just wondering if you're still working on this module or have other duties taken over. Been on to your website link for the project outline but nothings appears to have happened since mid May. :(

 
haggis
haggis's picture

Joined: 2004-05-27
Posts: 17
Posted: Tue, 2005-06-28 07:44
raph wrote:
Haggis,

Just wondering if you're still working on this module or have other duties taken over. Been on to your website link for the project outline but nothings appears to have happened since mid May. :(

I need to get back to work on this module, but I've been up to my ears in a project at work (which has been more or less a 24/7 thing). I think we're done in about a week and hope to resume work on the module shortly thereafter. I need to contact Bharat when the time comes, since he was in effect "steering" me through the process.

My apologies to the comunity in general, this project came at us right out of the blue and buried everyone bigtime, leaving literally no time in a day for any other "desireable" activities. For yrs truly, that means messing with G2! :lol:

 
Budgregor
Budgregor's picture

Joined: 2005-07-23
Posts: 1
Posted: Sat, 2005-07-23 23:02
haggis wrote:
I need to get back to work on this module, but I've been up to my ears in a project at work (which has been more or less a 24/7 thing).

We trust in you ;=)

Hope you can find some time in this. I agree to the first posting. This is a method to bring the use back to the site. The user has to be informed when something is new or has changed.

Thank you for your support.

And Gallery (including G2) is great.

Regards, Gregor.

 
Florie

Joined: 2005-05-22
Posts: 11
Posted: Sun, 2005-07-24 14:03

Hi,

I have troubles getting the code above into the AddComment.inc

Could you just tell me, where I have to past it.

Thx a lot!

 
Anonymous

Posted: Sun, 2005-08-14 13:42

Haggis, any news on the module?
I just found this thread and notifying me as an admin when new photos are uploaded is one functionality that I definitely need for upgrading to G2.
I know that there is a similar module in G1, perhaps you can find some additional infos there?
Please keep us updated! :)

 
id01

Joined: 2005-11-07
Posts: 62
Posted: Fri, 2005-12-30 05:04

I have trouble with the code as well, but that idea doesn't work very well becasue it will force every owner to recieve e-mail upon comment.
It is very nice, but not very useful when it is forced. Some might not want it.

Modulizes seem best, but a e-mail handler module might be a little too much for use to tackles. Especially for people who just want the old features in G1 to work again so they can upgrade at last.

I still think to developement team should first fix most of the performance issue, then match all the features so they can moves more developing power into G2 from G1 and become more foucsed, however, I guess they don't have time for either really. ^^;

 
MRiedl

Joined: 2006-01-08
Posts: 9
Posted: Tue, 2006-01-10 16:36

As I have trouble with the code too I tried to get it to work.
My solution look like:

                list ($ret, $item) = GalleryCoreApi::loadEntitiesById($itemId);

                list ($ret, $owner) = GalleryCoreApi::loadEntitiesById($item->getOwnerId());
                $ownerName = $owner->getFullName();

		list ($ret, $user) = GalleryCoreApi::loadEntitiesById($gallery->getActiveUserId());
		$userName = $user->getFullName();

		$emailSubj = '[Homepage] New picture comment';
		$emailContent = 'Greetings '.$ownerName.'!'."\n\n".
                                'New comment from user: '.$userName."\n".
                                'Subject: '.$form['subject']."\n".
                                'Comment: '.$form['comment']."\n".
                                'URL: http://www.your-page.com/wp-gallery2.php?g2_view=core.ShowItem&g2_itemId='.$itemId."\n\n".
				'This is an automatic mail.!';
		$from = 'email@host.de';
	  	mail($owner->getEmail(),$emailSubj,$emailContent, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from"); 

Add the code above line: /* Send the user to a confirmation page, for now */
I'm sure the code isn't clean. It's my first steps with coding in Gallery2.

greetings riedl

 
nicheplayer

Joined: 2005-08-03
Posts: 35
Posted: Thu, 2006-01-12 20:57

riedl, can you say exactly where you added this code? Was it in AddComment.inc? Thank you for your work!

 
MRiedl

Joined: 2006-01-08
Posts: 9
Posted: Thu, 2006-01-12 23:22

Yes, in AddComment.inc.
I don't wanna give you a line, maybe I deleted some empty lines above.

I added the code (in class AddCommentController, function handleRequest) between this lines

 ...
$ret = $comment->save();
if ($ret->isError()) {
    return array($ret->wrap(__FILE__, __LINE__), null);
}

INSERT THE CODE HERE

/* Send the user to a confirmation page, for now */
$redirect['view'] = 'comment.CommentChangeConfirmation';
...

Take care that if you want to test the function you use a picture you are the owner of :)

 
torres11

Joined: 2006-01-11
Posts: 9
Posted: Fri, 2006-01-13 00:02
Quote:
Take care that if you want to test the function you use a picture you are the owner of

Does this Only send you an Email if you are the owner of the picture? Is there a way you can change it to email you if a comment is left on any picture in the gallery?

 
MRiedl

Joined: 2006-01-08
Posts: 9
Posted: Fri, 2006-01-13 12:44

assumed that you don't mind to whom the mail addresses just add another line like (if the mail $from is yours):
mail($from,$emailSubj,$emailContent, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");
or else
mail('your@email.com',$emailSubj,$emailContent, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");
and replace the

 
torres11

Joined: 2006-01-11
Posts: 9
Posted: Sun, 2006-01-29 08:20

Here I am again asking another question? but how can I have it send me the Users Ip address also? I mean I have an idea how but I just dont even know where you guys get all these codes from? like the .$from .$phpversion or these codes from? Can someone help me out. Or at least tell me what the code is for asking for the userIP Thanks

 
MRiedl

Joined: 2006-01-08
Posts: 9
Posted: Wed, 2006-02-01 12:12

just edit one line, e.g.
'New comment from user: '.$userName." (".GalleryUtilities::getRemoteHostAddress().") \n".

phpversion is a php function.
from? do you maybe mean form? form is data from the form sent to insert the comment.

 
shyzer

Joined: 2005-12-01
Posts: 3
Posted: Fri, 2006-02-10 23:03

Ried, I just wanted to say thanks for writing this. I've been looking for some sort of notification system for comments and it looks like this is gonna do the trick! So again, thanks!

 
nicheplayer

Joined: 2005-08-03
Posts: 35
Posted: Wed, 2006-04-05 20:25

I can't believe this feature still didn't make the cut for Gallery 2.1.

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Thu, 2006-04-06 15:26
line 144:
		$ret = $comment->save();
		if ($ret) {
		    return array($ret->wrap(__FILE__, __LINE__), null);
		}
		
		/* added eMail Notification based on MRiedl's modification */
		list ($ret, $item) = GalleryCoreApi::loadEntitiesById($itemId);
		
		list ($ret, $owner) = GalleryCoreApi::loadEntitiesById($item->getOwnerId());
		$ownerName = $owner->getFullName();
		
		list ($ret, $user) = GalleryCoreApi::loadEntitiesById($gallery->getActiveUserId());
		$userName = $user->getFullName();
		
		$emailSubj = 'GALLERY2 - New picture comment added';
		$emailContent = 'Greetings '.$ownerName.'!'."\n\n".
				'New comment from user: '.$userName." (".GalleryUtilities::getRemoteHostAddress().") \n".
				'Subject: '.$form['subject']."\n".
		  	'Comment: '.$form['comment']."\n".
		   	'URL: http://YOUR-GALLERY-PATH/main.php?g2_view&g2_itemId='.$itemId."\n\n".
				'[ this is an automatic mail, generated by Gallery 2.1 !]';
		$from = 'SENDER@MAIL.COM';
		mail("FROM@MAIL.COM",$emailSubj,$emailContent, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");


		/* Send the user to a confirmation page, for now */
		$redirect['view'] = 'comment.CommentChangeConfirmation';
		$redirect['itemId'] = (int)$itemId;
		$status['added'] = 1;

Thanks MRiedl, I very slightly adjusted some code to fit normal Gallery 2.1 setups.Simply adjust the

,

and YOUR-GALLERY-PATH.
(And don't forget to protect the "AddComment.inc" against CVS updates ;))

Thanks again,
Lutz

Gallery version = 2.1 core 1.1.0
PHP version = 5.1.1 apache2handler
Webserver = Apache/2.2.0 (Win32) DAV/2 PHP/5.1.2 mod_ssl/2.2.0 OpenSSL/0.9.8a
Database = mysql 5.0.18-nt-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2006-04-06 18:14

code review:
- needs proper error handling (check $ret values)
- use $gallery->getActiveUser() instead of loading entity for getActiveUserId
- text strings should be translated
- putting email content in a tpl file and using GalleryCoreApi::sendTemplatedEmail would make it easier for others to customize the email (then they can use a local tpl)
- if you don't make this^ change then must use $platform->mail instead of mail() php function
- needs to use $gallery->getUrlGenerator() to generate URL (use forceFullUrl=true, forceSessionId=false and htmlEntities=false options) (and =core.ShowItem is missing from url above)
- gallery version number probably shouldn't be in the message, unless you get the actual number instead of hardcoded 2.1
- LFrank, you put "FROM@MAIL.COM" where the TO address goes.. the above code has $owner->getEmail()
- needs to check that $owner->getEmail() is not empty
- needs to have a site admin option to turn emails on/off
- needs to be unit tested

 
nicheplayer

Joined: 2005-08-03
Posts: 35
Posted: Thu, 2006-04-06 18:33

So, we should wait before modifying AddComment.inc with this code, then?

Thanks, LFrank, for your modifications. And here I was thinking you were merely a PGTheme genius. Looks like this feature is coming closer to reality all the time.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2006-04-06 22:14

nicheplayer, other than the "FROM@MAIL.COM" error the code above can work.. you're welcome you use it (at your own risk of course) until this feature is added.. the above review is what is needed to get this ready for CVS.

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Fri, 2006-04-07 11:18

mindless, OOps - that was a typo - I meant TO with FROM (have it hardcoded in my localized version)

Gallery version = 2.1 core 1.1.0
PHP version = 5.1.1 apache2handler
Webserver = Apache/2.2.0 (Win32) DAV/2 PHP/5.1.2 mod_ssl/2.2.0 OpenSSL/0.9.8a
Database = mysql 5.0.18-nt-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de

 
ngotau

Joined: 2006-04-25
Posts: 1
Posted: Tue, 2006-04-25 17:08

Hi,

I am a newbie, just starting up a personal gallery. I have tried the above code. It works fine for the first test. Hope there will be no serious bug.
Thanks

----------------------------------------
Gallery version = 2.0 core 1.0.0
PHP version = 4.3.11 apache
Webserver = Apache/1.3.33 (Unix) mod_gzip/1.3.26.1a mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2634a mod_ssl/2.8.22 OpenSSL/0.9.7a
Database = mysql 4.1.18-standard
Toolkits = ArchiveUpload, ImageMagick, Exif, NetPBM, Thumbnail, Gd
Operating system = Linux pass30.dizinc.com 2.4.29-ow1 #1 SMP Sat Apr 23 02:22:15 EDT 2005 i686
Browser = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1

 
Steel Rat
Steel Rat's picture

Joined: 2006-06-24
Posts: 100
Posted: Sat, 2006-07-01 23:40

Actually the code listed by LFrank does NOT have $owner->getEmail(); IT would need to be added to work without a hardcoded email addressee.

Would be nice if someone could polish this up to make it friendlier for Gallery.

Steel Rat
RPGMapShare.com

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Mon, 2006-09-11 17:01

This is exactly the functionality I have been looking for. But what the heck are you guys talking about? I get the basic idea that some code has to be modified somewhere. Can someone help out a newbie with what I do with all that code? Let's back up. How do I find out what version of Gallery I'm running? Then what do I do with the code? Thanks to all who worked on this.

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Mon, 2006-09-11 19:02

@Steel Rat: the $owner->getEmail() did for some reason -I don't know why - not work on my system ... that's the reason I'ver coded it the way listed.

@Captenaj: you need to modify the AddComment.inc (from \modules\comment) around line 144 and change some placeholder to your configuration.

CU
Lutz

Gallery version = 2.2-svn core 1.1.16
PHP version = 5.1.6 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.6 mod_ssl/2.2.3 OpenSSL/0.9.8c
Database = mysql 5.1.11 beta-log,
Theme=PGlightbox,
Gallery-URL=http://lf-photodesign.de

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Tue, 2006-09-12 18:18

Thanks for your response, LFrank. I found the file and made a copy (for when I mess up and have to upload the original again). Am I to understand that I replace the code:

$ret = $comment->save();
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}

/* Send the user to a confirmation page, for now */
$redirect['view'] = 'comment.CommentChangeConfirmation';
$redirect['itemId'] = (int)$itemId;
$status['added'] = 1;

with the code you have supplied above? It seems that the line "if ($ret->isError()) {" will then be replaced by "if ($ret) {". Is that OK or am I not understanding something? Thank you again.

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Tue, 2006-09-12 18:24
Quote:
(And don't forget to protect the "AddComment.inc" against CVS updates ;))

Good advice! Er... what does this mean (I don't really need to know) and how do I do this? Thanks.

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Tue, 2006-09-12 18:36

Captenaj, put/insert the new lines in front of the "Send to confirmation page" ... there should nothing to be deleted. It simply adds to the existing code.

   ...
	$comment->setComment($form['comment']);
		$comment->setDate(time());

		$ret = $comment->save();
		if ($ret) {
		    return array($ret, null);
		}
		
		 /* added eMail Notification based on MRiedl's modification */
		list ($ret, $item) = GalleryCoreApi::loadEntitiesById($itemId);
		if ($ret) {
			return array($ret->wrap(__FILE__, __LINE__), null);
		}
		
		list ($ret, $owner) = GalleryCoreApi::loadEntitiesById($item->getOwnerId());
		if ($ret) {
			return array($ret->wrap(__FILE__, __LINE__), null);
		}
		$ownerName = $owner->getFullName();
		$ownerEMail = $owner->getEmail();
		
		list ($ret, $user) = GalleryCoreApi::loadEntitiesById($gallery->getActiveUserId());
		if ($ret) {
			return array($ret->wrap(__FILE__, __LINE__), null);
		}
		$userName = $user->getFullName();
		
		$emailSubj = 'GALLERY2 - New picture comment added';
		$emailContent = 'Greetings '.$ownerName.'!'."\n\n".
			'New comment from user: '.$userName." (".GalleryUtilities::getRemoteHostAddress().") \n".
			'Subject: '.$form['subject']."\n".
		  'Comment: '.$form['comment']."\n".
		  'URL: http://localmail.dynip.com/GALLERY2/main.php?g2_view=core.ShowItem&g2_itemId='.$itemId."\n\n".
			'[this is an automatic mail, generated by Gallery !]';
		$from = 'cps@lf-photodesign.de';
		mail("cps@lf-photodesign.de",$emailSubj,$emailContent, "From: $from\nX-Mailer: PHP/ . $phpversion()", "-f $from");
				

		/* Send the user to a confirmation page, for now */
		$redirect['view'] = 'comment.CommentChangeConfirmation';
		$redirect['itemId'] = (int)$itemId;
		$status['added'] = 1;
	    }
   ...

Btw. SVN is more clever than CVS ... it merges the change locally ;) - you only need to think about if you update from nightly archives (there was a switch from CVS to SVN sometimes ago - no need to bother any longer).

I've attached my "AddComments.inc" for your reference (don't forget to adjust your e-mails and gallery path).

Gallery version = 2.2-svn core 1.1.16
PHP version = 5.1.6 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.6 mod_ssl/2.2.3 OpenSSL/0.9.8c
Database = mysql 5.1.11 beta-log,
Theme=PGlightbox,
Gallery-URL=http://lf-photodesign.de

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Tue, 2006-09-12 23:28

Thanks, LFrank. I appreciate your help. What is my gallery path? Is it just http://www.elliottsnest.net/photos? Or is it supposed ot have some of that main.php?g2_view=core stuff on it too? Sorry to be so dumb about this. I appreciate your time.

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Wed, 2006-09-13 04:32

Captemaj, just replace "http://localmail.dynip.com/GALLERY2/" with your "http://www.elliottsnest.net/photos/" and leave the main.php? stuff ...

Gallery version = 2.2-svn core 1.1.16
PHP version = 5.1.6 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.6 mod_ssl/2.2.3 OpenSSL/0.9.8c
Database = mysql 5.1.11 beta-log,
Theme=PGlightbox,
Gallery-URL=http://lf-photodesign.de

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Wed, 2006-09-13 13:46

Thank you again for your response. When the line in question reads
'URL: http://www.elliottsnest.net/photos/main.php?g2_view=core.ShowItem&g2_itemId='.$itemId."\n\n".

I get the following error:

Parse error: syntax error, unexpected T_ELSE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/.calico/pamwoman/elliottsnest.net/photos/modules/comment/AddComment.inc on line 144

Line 144 is: $redirect['itemId'] = (int)$itemId;

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Wed, 2006-09-13 14:34

Hmm. it looks like something got 'lost' ... the $redirect should be after the inserted lines, can you attach your file to have a look?

Gallery version = 2.2-svn core 1.1.16
PHP version = 5.1.6 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.6 mod_ssl/2.2.3 OpenSSL/0.9.8c
Database = mysql 5.1.11 beta-log,
Theme=PGlightbox,
Gallery-URL=http://lf-photodesign.de

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Thu, 2006-09-14 00:07

I have attached the file. Thank you.

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Thu, 2006-09-14 04:28

Captenaj, you have the "/* Send user to confirmation page, for now */" twice and therefore a "}" too much, remove lines 142 to 146 (these are duplicates to 134-138). And line 91-99 (these wouldn't cause an error - but will be better to have them out I assume).

Gallery version = 2.2-svn core 1.1.16
PHP version = 5.1.6 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.6 mod_ssl/2.2.3 OpenSSL/0.9.8c
Database = mysql 5.1.11 beta-log,
Theme=PGlightbox,
Gallery-URL=http://lf-photodesign.de

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Thu, 2006-09-14 16:47

I see that. Thank you. I took the offending code out (actually, I modified the original document with your changes once again) and I am able to leave a comment but I get a new error message. I do not get a confirmation email. The error message is:

Error
An error has occurred.

Back to the Gallery

Error Detail -
Error (ERROR_LOCK_REQUIRED)
in modules/core/classes/GalleryEntity.class at line 264 (gallerystatus::error)
in modules/comment/AddComment.inc at line 99 (gallerycomment::save)
in main.php at line 174 (addcommentcontroller::handlerequest)
in main.php at line 87
in main.php at line 80
System Information
Gallery version 2.0.3
PHP version 4.4.2 cgi
Webserver Apache/1.3.33 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.4.2 mod_ssl/2.8.22 OpenSSL/0.9.7e
Database mysql 5.0.18-standard-log
Toolkits ImageMagick, NetPBM, Gd
Operating system Linux digdug 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+++p4+c6+gr2b-v6.192 #1 SMP Wed Dec 14 17:00:09 PST 2005 i686
Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Thu, 2006-09-14 17:42

Hmm, I know it running with 2.1 and newer ... why don't you update from 2.03?

Gallery version = 2.2-svn core 1.1.16
PHP version = 5.1.6 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.6 mod_ssl/2.2.3 OpenSSL/0.9.8c
Database = mysql 5.1.11 beta-log,
Theme=PGlightbox,
Gallery-URL=http://lf-photodesign.de

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Thu, 2006-09-14 18:24

OK, if you think that may help I'll give it a go. I'll read over the documentation and update it tonight after work. Thank you for all your help. I'll let you know how it turns out.

 
LFrank

Joined: 2005-02-19
Posts: 1023
Posted: Thu, 2006-09-14 18:32

OK, I'll keep fingers crossed ...

Gallery version = 2.2-svn core 1.1.16
PHP version = 5.1.6 apache2handler
Webserver = Apache/2.2.3 (Win32) DAV/2 PHP/5.1.6 mod_ssl/2.2.3 OpenSSL/0.9.8c
Database = mysql 5.1.11 beta-log,
Theme=PGlightbox,
Gallery-URL=http://lf-photodesign.de

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Tue, 2006-09-26 17:02

No go. I successfully upgraded to Gallery 2.1 core 1.1.0. If I run Gallery with the original AddComment.inc file it works fine. When I change the file as specified above, I get the following error:

Fatal error: Call to a member function on a non-object in /home/ccc/xmen/yoururl.com/photos/modules/comment/AddComment.inc on line 179

Line 179 & 180 are:

if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);

The text right before the addition of the new code is

$ret = $comment->save();
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);

in my original AddComment.inc file but is

$ret = $comment->save();
if ($ret) {
return array($ret, null);
}

in the sample code I copied from above. Does that matter.

Attached in my latest version of my AddComment.inc file. Thank you again (and again) for your help.

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Tue, 2006-09-26 17:00

Oh no! Now I can't get it to work at all. I WAS working with the new version of Gallery. I swear it was. I re-uploaded my original AddComment.inc file and now I get the error:

Fatal error: Call to a member function on a non-object in /home/ccc/xmen/yoururl.com/photos/modules/comment/AddComment.inc on line 145

With line 145 being the same one as I quoted in my previous posting.

What have I done????? Thanks.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-09-15 02:41

$ret->isError() is 2.0.x code.
make sure all the files and code changes you're working with are for 2.1.x.

 
Captenaj

Joined: 2006-03-27
Posts: 43
Posted: Fri, 2006-09-15 03:19

That would explain it. I think I must have deleted the AddComment.inc file that came with the upgraded version of Gallery. How can I get another copy? Can someone give me a copy of theirs or can I download it from gallery somewhere? If I uninstall and then reinstall the module, will that work? Will it delete all my old comments? Thanks.