add "view this albums comments" for each album in

cersa
cersa's picture

Joined: 2003-01-12
Posts: 11
Posted: Thu, 2003-07-10 02:42

ok.. it has come down to me begging for help. All I want to do is add a link that allows anyone to view the comments in a album from the main gallery page..

just like the link on this webpage. http://www.tnatech.com/gallery **this is not my webpage and I hope I don't get in trouble for adding it here for reference** I just wanted to show everyone, exactly what I am looking for. If I am not supposed to do that ... someone please delete this post.

Anyhow... I want to add a this option for my viewers. I searched the forums and did some research... honest... and I seen lots of options.. . but not the one I am looking for.

If anyone has the time and knowledge to assist me, that would be super cool. :D Thanks, Angel

 
BorgKing
BorgKing's picture

Joined: 2002-09-12
Posts: 314
Posted: Thu, 2003-07-10 18:38

Hey Angel!

I like your site, especially the girlish looks ;)

Anyway, what you want to do isn't that hard. Normally the comments (view_comments.php) are only viewable for admins and album owners. If you want to change that, open view_comments.php and find the line:if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {This is line 36 in Gallery 1.3.3 or line 39 in Gallery 1.3.4. Replace this line byif (!$gallery->user->canReadAlbum($gallery->album)) {Now the comments page can be viewed by all users who can read the album.

To get a link on the main page of Gallery, like in the example you mentioned (you can _always_ link to websites, that's the way the internet works), you'll need to open albums.php and find

  <br>
  <?php if (strcmp($gallery->app->default["showOwners"], "no")) { ?>

This is line 240 in Gallery 1.3.3 and line 253 in Gallery 1.3.4. Between these two lines you should add the code

<span class="fineprint">
<a href=' . makeGalleryUrl("view_comments.php", {$tmpAlbumName}) . '>[View This Albums Comments]</a></span>
<br>

I haven't tested the changes to albums.php, so let me know if they don't work. Good luck.

 
cersa
cersa's picture

Joined: 2003-01-12
Posts: 11
Posted: Thu, 2003-07-10 21:30

Hi! Angel here. Thanks for responding to my post. It means a lot that people like yourself with the knowledge you have helping out the less fortunate! I followed your instructions.... I messed up along the way. The link is there, but pointing to a dead end. I listed what I did below.

step 1 - in view_comments.php

I changed this code:
if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {

to this code:
if (!$gallery->user->canReadAlbum($gallery->album)) {

Step 2 - adding the link - in albums.php

I found this code:
<br>
<?php if (strcmp($gallery->app->default["showOwners"], "no")) { ?>

and inserted this code:
<span class="fineprint">
<a href=' . makeGalleryUrl("view_comments.php", {$tmpAlbumName}) . '>[View This Albums Comments]</a></span>
<br>

making it look like this after I added:
<br>
<span class="fineprint">
<a href=' . makeGalleryUrl("view_comments.php", {$tmpAlbumName}) . '>[View This Albums Comments]</a>
</span>
<br>
<?php if (strcmp($gallery->app->default["showOwners"], "no")) { ?>

So what do you think?
Thanks for visiting my website!! More girlish looks to come! :D
Angel

 
BorgKing
BorgKing's picture

Joined: 2002-09-12
Posts: 314
Posted: Thu, 2003-07-10 22:32

The problem is in this line:
<a href=' . makeGalleryUrl("view_comments.php", {$tmpAlbumName}) . '>[View This Albums Comments]</a>

There's some code in here, but I forgot to put it between tags, so try changing it to <a href='<?php makeGalleryUrl("view_comments.php", {$tmpAlbumName})?>'>[View This Albums Comments]</a>
and see what happens. Alternatively, you can try<a href='view_comments.php?albumName=<?php $tmpAlbumName ?>'>[View This Albums Comments]</a>

 
cersa
cersa's picture

Joined: 2003-01-12
Posts: 11
Posted: Fri, 2003-07-11 01:38

thanks for all of your help.
I just can't seem to get it working.. and I am making things worse getting errors...
I probably should stop while I am ahead... before gallery explodes on my desk top!!
Thanks again,
Angel

 
cersa
cersa's picture

Joined: 2003-01-12
Posts: 11
Posted: Fri, 2003-07-11 14:47

Another day... another attempt! (only one error remains)

I tried you ideas..
When I click on the "view this albums comments" it brings an error of:
Fatal error: Call to a member function on a non-object in /home/angel/public_html/Gallery/classes/User.php on line 90

in album.php the code this is the code:
<br>
<span class="fineprint">
<a href='view_comments.php?albumName=<?php $tmpAlbumName ?>'>[View This Albums Comments]</a></span>
<br>

I looked at the user.php and line 90 this is the code:
function canReadAlbum($album) {
if ($this->isAdmin()) {
return true;

Its going to be a great day!
:D Angel

 
BorgKing
BorgKing's picture

Joined: 2002-09-12
Posts: 314
Posted: Fri, 2003-07-11 17:03

As you can see, I'm not really a PHP programmer, and I usually work with trial-and-error ;)

In your page, the albumName doesn't get printed. Why? Because I forgot the print command :roll:

So try changing
<a href='view_comments.php?albumName=<?php $tmpAlbumName ?>'>[View This Albums Comments]</a></span>
to <a href='view_comments.php?albumName=<?php print $tmpAlbumName ?>'>[View This Albums Comments]</a></span>

Have a nice day!

 
KenB
KenB's picture

Joined: 2003-06-27
Posts: 27
Posted: Fri, 2003-07-11 17:35

Hi Angel...

Try this (be sure to start with a fresh set of these files so you're sure you aren't mixing up various edits)...

In view_comments.php (on line 39 in Gallery 1.3.4)...

Change this:
if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {

To this:
if (!$gallery->user->canReadAlbum($gallery->album)) {

...so that everyone has rights to view all comments.

Next...

In albums.php (on line 327 in Gallery 1.3.4.)...

Look for:
<br><br>This album has been viewed <?php echo pluralize($gallery->album->getClicks(), "time", "0")?> since <?php echo $gallery->album->getClicksDate()?>.

And add this line immediately after it:
<br><br><a href=<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" => $tmpAlbumName))?>>[View Comments]</a>

This will create the "View Comments" link on the main Gallery index page.

Lastly...

In commentboxtop.inc in the layout folder (on line 20 in Gallery 1.3.4)...

Change this:
<?php if ($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($myAlbum)) { ?>

To this:
<?php if ($gallery->user->canReadAlbum($gallery->album)) { ?>

...to enable visitors to see and use the "View Comments In This Nested Album" links if you have any nested albums.

Upload those 3 files and you should be good to go! I use this same hack on my galleries and it works like a charm.

Hope this helps.

 
cersa
cersa's picture

Joined: 2003-01-12
Posts: 11
Posted: Fri, 2003-07-11 20:02

Okey dokey! I got it working now. :D

BorgKing - I did the last thing you suggested, and I received the error still.
KenB also left me some options and I got the view comments working with that. Yippieee! However now I have the IP addresses next to the comments which I don't like much. So I am off to research that.

If you know how to remove the IP let me know, that would be the icing on the cake!

Thank so much for your help guys! Its is much appreciated. Go take a look at the gallery if you like http://www.totallyangel.com/Gallery/ you can click the view comments link and it works!! Thanks to you guys!
:D Angel

 
BorgKing
BorgKing's picture

Joined: 2002-09-12
Posts: 314
Posted: Fri, 2003-07-11 22:03

Yeah, sorry I couldn't get the code in albums.php working. Thanks KenB!

As for the IP-address, you'll have to look up in the code of view_comments.php where the IP address is inserted (I have been away from my regular computer the last few posts, so I couldn't look up the Gallery code). But anyway, find where the IP address is inserted, and put it betweenif (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {and }

Good luck with that!

 
KenB
KenB's picture

Joined: 2003-06-27
Posts: 27
Posted: Sat, 2003-07-12 01:09

The IP address only shows when you are logged in as admin. Regular visitors won't see the IP address.

 
cersa
cersa's picture

Joined: 2003-01-12
Posts: 11
Posted: Sat, 2003-07-12 02:44

ok, here is the scoop.
BorgKing ~ I looked in view_comments.php for ip address code... I am not sure what I was looking for.. but nothing in there said IPaddress... when I find the code in view_comments.php ...... then I put that code from view_comments.php between

if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {

and }

which is found inside of albums.php .. right? Because I did not see it in view_comments.php

phew , this is confusing.

KenB ~ go to my gallery at http://www.totallyangel.com/Gallery viewers can still see the ip address. ?? I seems admins are only supposed to see it... but if you click on it there it is..

What if I tried upgrading? I have 1.3.3 now, if I upgrade would that fix the IP address thing? I don't think it would since I added the view all comment thing .. ??

Its all good!
Angel

 
KenB
KenB's picture

Joined: 2003-06-27
Posts: 27
Posted: Sat, 2003-07-12 03:50

I see what you are talking about now...

The file that does this is commentbox.inc in the layout folder.

Look for this: (line 5 for Gallery 1.3.4.)...

From: <?php echo $comment->getName() ?> @ <?php echo removeTags($comment->getIPNumber())?> (<?php echo $comment->getDatePosted() ?>)

And change it to this:
From: <?php echo $comment->getName() ?> (<?php echo $comment->getDatePosted() ?>)

Hope that does the trick!

P.S. This will remove the display of the IP address even for admins, but only on the View Comments pages. The IP address will still be displayed (only for admins) on the full-size pic pages where the comments are displayed below the pic.

 
cersa
cersa's picture

Joined: 2003-01-12
Posts: 11
Posted: Sat, 2003-07-12 16:14

KenB
It worked like a charm. Thanks so much for assisting me in changing my gallery.

You too BorgKing! Thanks for all of your help!

:D Have a wonderful weekend!
Angel

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Thu, 2003-09-04 04:03

Has anyone gotten this mod to work with 1.4 RC2? Still is only letting the admin see the mod, and I don't think it's bringing up the comments on the sub-album view page correctly.

UPDATE (9/4/03): I had to open and close the scripting tags to be able to add the mod in albums.php in the correct place, so now all users can see it. I'm still not sure if this is working as intended though. It'd be nice if there was an additional indicator on the sub-albums page IF there are comments available, or the time/date of the most recent comments... visible on the sub-album page.

 
anonymous11234

Joined: 2002-12-05
Posts: 135
Posted: Fri, 2003-09-05 12:19

I have all this working on my gallery http://ourphotos.org (vs. 1.4) but still only admin can see the link.

Can someone give the code to change so that everyone can see that link not just the admin.

***As an aside - I created a link <a href="http://ourphotos.org/view_comments.php?set_albumName=wendy1">[ View all
Comments ]</a>

In the album description that is a good quick fix, but I hoped to have that come up automatically.

Thanks

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Fri, 2003-09-05 18:32

Chris, I'm not quite clear about your last post.

What link is visible only to the admin for your site? Is it the link at the top-right when you're viewing an album?

 
hualum

Joined: 2003-09-07
Posts: 1
Posted: Sun, 2003-09-07 07:23

There are some differents in 1.4-RCx, cause 1.4 is supporting multilanguage. In 1.4-RC3, albums.php shoulde be modified like below.

Find this...

Quote:
<span class="error">
<?php echo _("Note: This album is out of date!") ?> <?php echo popup_link("[" . _("upgrade album") ."]", "upgrade_album.php") ?>
</span>
<?php } ?>
<?php } ?>
<?php } ?>

And add this line after it:

Quote:
<a href=<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" => $tmpAlbumName)) ?>>[<?php echo _("view&amp;comments") ?>]</a><br>

others' are just like KenB's setting...

Try it!

--
I'm from Asia, so excuse for my broken English...:P

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Mon, 2003-09-08 21:29

It'd be nice to have an indicator on the sub-albums page that shows which albums had comments available, rather than just the ability to blindly "View comments for this nested album".... perhaps even just adding the * on the sub-album page to indicate if there are comments available in a particular sub-album. Anyone have ideas of how to do this?

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Sat, 2003-09-13 00:46
ODiN wrote:
perhaps even just adding the * on the sub-album page to indicate if there are comments available in a particular sub-album. Anyone have ideas of how to do this?

upgrade to 1.4.1-b74 or greater.

Just be adding this to the main gallery source.

You can also have last comment date instead of the star if you like.

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Sat, 2003-09-13 17:30

Thanks Joan,

I wasn't aware that these features had been implemented in 1.4.1. Guess I'll have to finally learn how to use CVS.

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Sat, 2003-09-13 19:29

Well I just set up my CVS client, but the version of Gallery that is showing is 1.4.1-b64. What am I doing wrong?

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Sat, 2003-09-13 23:37

ODiN,

It wasn't in 1.4.1 when you made the request :-)

And CVS: sorry about that, the anonymous server lags the writable server by a substantial margin. Keep checking and also keep an eye on http://www.jpmullan.com/galleryupdates

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Sun, 2003-09-14 00:22

Well that's awesome then! :) Thanks for all the help Joan. I'll keep my eyes peeled...

 
moritz69

Joined: 2003-07-30
Posts: 8
Posted: Mon, 2003-09-15 13:18

thank you KenB and BorgKing very much for this hack!

it worked immediatly on my site! www.kingkluge.de

 
quadris

Joined: 2003-07-09
Posts: 27
Posted: Sat, 2003-09-27 10:10

hi, i followed your introctions to make the "view comments" public...
but my problem is, in some gallerys it work inother it doesn't :(
here is a screenshot:
[img]http://members.e-server.at/felix/felix/gallery.jpg[/img]

greats,
quadris

 
mupf3l

Joined: 2003-09-29
Posts: 31
Posted: Tue, 2003-09-30 08:19

hi,

i have made the changes, and while logged in as admin it works great.
as soon as I am anonymous, I get the follwing error:

Fatal error: Call to a member function on a non-object in /home/www/de.pgt/html_privat/modules/gallery/classes/User.php on line 240

i am not sure where it comes from. testing on today cvs checkout...

 
agilos

Joined: 2003-10-11
Posts: 9
Posted: Sat, 2003-10-11 07:16

I had quite a bit of trouble getting this to work with the code provided here. So i just wanted to post the way i got it to work...maybe this method will help those who are still getting errors.

This first step was provided by BECKETT, i took part of his code:

1) Everyone see the link:

In albums.php , find this code:
Code:

<?php if ($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($gallery 
->album)) { ?> 
   <span class="admin"> 
    <?php echo popup_link("[" . _("permissions") ."]", "album_permissions.php?se 
t_albumName={$tmpAlbumName}"); ?> 
   <?php if (!strcmp($gallery->album->fields["public_comments"],"yes")) { ?> 
    <a href=<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" 
=> $tmpAlbumName)) ?>>[<?php echo _("view&comments") ?>]</a> 
   <?php } ?> 

This was the exact link that I moved out of the admin section

<?php if (!strcmp($gallery->album->fields["public_comments"],"yes")) { ?>
<a href=<?php echo makeGalleryUrl("view_comments.php", array("set_albumName"
=> $tmpAlbumName)) ?>>[<?php echo _("view&comments") ?>]</a>
<?php } ?>

Move the link line out of the "admin" if {} block.
Just paste it lower in the code and it will pop up on the main page.

2) Then Follow This Code Provided By KenB

In view_comments.php (on line 39 in Gallery 1.3.4)...

Change this:
Code:
if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {

To this:
Code:
if (!$gallery->user->canReadAlbum($gallery->album)) {

...so that everyone has rights to view all comments.

3) Last I followed this code by KenB again:

In commentboxtop.inc in the layout folder (on line 20 in Gallery 1.3.4)...

Change this:
Code:
<?php if ($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($myAlbum)) { ?>

To this:
Code:
<?php if ($gallery->user->canReadAlbum($gallery->album)) { ?>

...to enable visitors to see and use the "View Comments In This Nested Album" links if you have any nested albums.

And now it should work....i tried all the diff codes in this post but this was the combination that worked for me. Hope this helps someone.

To see it in action check my site: Http://walkingwithsharks.com

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Sat, 2003-10-11 10:03

agilos:

Glad you got it working, and thanks for the detailed how-to! :)

-Beckett (

)

 
tart666

Joined: 2003-10-20
Posts: 6
Posted: Mon, 2003-10-20 01:31

Got this to work thanks all! yay!

quick follow-up: did anyone figure out how to show the "view_comments" link only if there are some comments?

 
efurban

Joined: 2002-12-17
Posts: 15
Posted: Wed, 2003-11-19 17:19

am working on a comment counter so that you 'll see a number which indicates the total comments inside of a albums.

I'll post it here as soon as I get it done.
( it's gonna be after my final exams though ... which is within 2 days )

:)

 
agilos

Joined: 2003-10-11
Posts: 9
Posted: Wed, 2003-11-26 03:26

efurban,

I would really like to see that work. I have been looking for a way that shows the total number of comments for each album on the "view all comments" page. This feature would be helpful. Just letting you know of my interest as well im sure others would find this useful! Thanks!

 
efurban

Joined: 2002-12-17
Posts: 15
Posted: Wed, 2003-11-26 22:53

*** update: this heck is also work for gallery_1.4.2-b74 -- tested ***

as I promised, here is the code and steps :

/**
* hack: recursively count the total number of comments in a album (gallery)
* Author: Travis Wu
* Email:

* Date: Nov 26, 2003
* the code below partially are from the posts in this forum, thanks for
* whoever helped.
*/

this will give you:

- view comment link on the right side of
"Last comment xx/xx/xxxx." so that everybody can
check the comments.

- total number of comments on the right side of [View]

- total number of comments in each nested album

- the view comments link shows up when the album has comments > 0

steps:

1) gallery/layout/commentboxtop.inc
find
<?php if ($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($myAlbum)) { ?>

replace it with :
<?php if ($gallery->user->canReadAlbum($gallery->album)) { ?>

find
<br><a href="<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" => $myAlbumName)) ?>">[<?php echo _("view comments for this nested album"); ?></a>

replace it with

<br><a href="<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" => $myAlbumName)) ?>">[<?php          echo _("view comments for this nested album"). " <font color=\"ff0000\">(".$myAlbum->commentRecursiveCount().")</font>"?>]</a>
    

2) gallery/view_comments.php
find
if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {
replace it with
if (!$gallery->user->canReadAlbum($gallery->album)) {

3) gallery/albums.php
find
print lastCommentString($lastCommentDate, $displayCommentLegend);
add the following after it:

  if (lastCommentString($lastCommentDate, $displayCommentLegend ) != ""){
	print
        " <a href=".
        makeGalleryUrl("view_comments.php", array("set_albumName" => $tmpAlbumName)).
         "> <font color=\"ff0000\">[</font>View<font color=\"ff0000\">]</font></a>".
         "  Total: " . "<font color=\"ff0000\">".
         $gallery->album->commentRecursiveCount()."</font>";  // add the comment counter
      } 

4) gallery/classes/Album.php
find

  function isRoot() { 
             if ($this->fields["parentAlbumName"]) return 0;
             else return 1;
        } 

add the following after it

   function countComment($i) {
	       	$photo = $this->getPhoto($i);
	       	if ($photo->isAlbumName) {
		       	$album = $this->getNestedAlbum($i);
		       	return $album->commentRecursiveCount();
	       	} else {
		       	return $photo->numComments($photo);
	       	}
	}
	function commentRecursiveCount() {
	       	$count = $this->numPhotos(1);
		$commentCount = 0;
	       	for ($i = 1; $i <= $count; $i++) {
			$commentCount += $this->countComment($i);
	       	}
		return $commentCount;
	}
   

done!!

I am using the newest version of Gallery (v1.4.2-cvs-b30) from CVS.
however, it should work w/ 1.4.1 and other version as well.

If you have any problem, let me know.

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Thu, 2003-11-27 06:58

Travis,

Thanks for working on this! This is exactly the type of functionality I think Gallery should have built in. Good work!

 
agilos

Joined: 2003-10-11
Posts: 9
Posted: Thu, 2003-11-27 22:45

Efurban,

Good job on the added count feature though I cant find where Im supposed to apply step 3. That piece of code doesnt seem to be in Gallery v1.4-pl2. Let me know if its an oversight by my part.

Thanks

 
ODiN

Joined: 2003-09-04
Posts: 21
Posted: Sat, 2003-11-29 00:46

agilos,

I may be wrong, but I'm pretty sure the Last Comment Date feature wasn't added until 1.4.1.

 
efurban

Joined: 2002-12-17
Posts: 15
Posted: Sat, 2003-11-29 03:41

Thanks eveybody for reply me back. :P

did you solve your problem agilos ?

You probably wanna update your gallery to a newer version .

well, it's not hard to get it working for your version as well.

Let me know.

 
agilos

Joined: 2003-10-11
Posts: 9
Posted: Sat, 2003-11-29 21:29

Thanks for the the info Odin and Efurban, I just downloaded Gallery 1.4.1. Just out curiousity before I upgrade, do happen to know what I would need to add to 1.4-pl2 to get step 3 to work. If its to much trouble, dont sweat it i'll just upgrade sometime next week.

 
wally007

Joined: 2004-01-19
Posts: 9
Posted: Wed, 2004-01-21 11:12

Well thanks efurban but i have 1.4.1 gallery from 25th November ( the one i was pointed out to download )

" Fatal error: Call to undefined function: commentrecursivecount() in C:\Program Files\Abyss Web Server\htdocs\albums.php on line 421 "

I did all the steps ( 1 , 2 ,3 , 4 ... ) and i see red star leading me from album to sub album and then to image that has comment. but nothing like you mentioned. Can you please see what's up with our version (1.4.1) ?

When i remove what you added in step 3 ( gallery/albums.php ) i can see my all my albums and red star leading saying " this item contains comments". When i put it in what you added in step 3 , i get that error and i loose some albums in main gallery.

thanks for help !

 
midkiff

Joined: 2003-06-27
Posts: 70
Posted: Wed, 2004-02-18 17:01

Has anyone got this to work with Gallery 1.4.2 yet? Please let me know, this hack is great and I would like to use it with the newest version. Thanks!

 
midkiff

Joined: 2003-06-27
Posts: 70
Posted: Wed, 2004-02-18 18:07

Nevermind, I figured it out

 
midkiff

Joined: 2003-06-27
Posts: 70
Posted: Fri, 2004-04-23 15:56
efurban wrote:
*** update: this heck is also work for gallery_1.4.2-b74 -- tested ***

steps:

1) gallery/layout/commentboxtop.inc
find
<?php if ($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($myAlbum)) { ?>

replace it with :
<?php if ($gallery->user->canReadAlbum($gallery->album)) { ?>

find
<br><a href="<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" => $myAlbumName)) ?>">[<?php echo _("view comments for this nested album"); ?></a>

replace it with

<br><a href="<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" => $myAlbumName)) ?>">[<?php          echo _("view comments for this nested album"). " <font color=\"ff0000\">(".$myAlbum->commentRecursiveCount().")</font>"?>]</a>
    

2) gallery/view_comments.php
find
if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->album)) {
replace it with
if (!$gallery->user->canReadAlbum($gallery->album)) {

3) gallery/albums.php
find
print lastCommentString($lastCommentDate, $displayCommentLegend);
add the following after it:

  if (lastCommentString($lastCommentDate, $displayCommentLegend ) != ""){
	print
        " <a href=".
        makeGalleryUrl("view_comments.php", array("set_albumName" => $tmpAlbumName)).
         "> <font color=\"ff0000\">[</font>View<font color=\"ff0000\">]</font></a>".
         "  Total: " . "<font color=\"ff0000\">".
         $gallery->album->commentRecursiveCount()."</font>";  // add the comment counter
      } 

4) gallery/classes/Album.php
find

  function isRoot() { 
             if ($this->fields["parentAlbumName"]) return 0;
             else return 1;
        } 

add the following after it

   function countComment($i) {
	       	$photo = $this->getPhoto($i);
	       	if ($photo->isAlbumName) {
		       	$album = $this->getNestedAlbum($i);
		       	return $album->commentRecursiveCount();
	       	} else {
		       	return $photo->numComments($photo);
	       	}
	}
	function commentRecursiveCount() {
	       	$count = $this->numPhotos(1);
		$commentCount = 0;
	       	for ($i = 1; $i <= $count; $i++) {
			$commentCount += $this->countComment($i);
	       	}
		return $commentCount;
	}
   

done!!

Does anyone know what I need to change to get this to work with gallery 1.4.3? I am getting an error:

Parse error: parse error in /home/mydamnpa/public_html/pics/layout/commentboxtop.inc on line 24

This is what line 24 reads:
<br><a href="<?php echo makeGalleryUrl("view_comments.phpbr><a href="<?php echo makeGalleryUrl("view_comments.php",array("set_albumName" => $myAlbumName)) ?>">[<?php echo _("view comments for this nested album"). " <font color=\"ff0000\">(".$myAlbum->commentRecursiveCount().")</font>"?>]</a></span>

This worked fine for version 1.4.2. Can anyone help with this?

 
midkiff

Joined: 2003-06-27
Posts: 70
Posted: Mon, 2004-04-26 20:48

Can anyone help me with this please?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2004-04-26 22:37

midkiff,
Looks to me like you need to go over step #2 again. Line 24 should not look like that. You have makeGalleryUrl("view_comments.phpbr><a href="<?php

You are missing stuff between the php & br (bold above)

Dave

 
midkiff

Joined: 2003-06-27
Posts: 70
Posted: Mon, 2004-04-26 22:53

Thanks! I guess I need to pay more attention next time I am copying and pasting! Sometimes it just takes another set of eyes checking it out.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2004-04-26 22:56

midkiff,
I have fat fingers too!

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Sat, 2004-05-01 23:42

Hi guys,
i love this simple and usefull hack but i can't get it working with my 1.4.3 gallery. I've changed everything and double checked but i can't see neighter results nor errors :(
www.mcgrelio.com/bin/gallery

Does this hack work with gallery 1.4.3?
Thx

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2004-05-02 00:30

mcgrelio,
Looking at your site it looks like you don't have the * (at the bottom of the page) when comments are entered. Have modded albums.php before?
If you look at albums.php, where you did the change for this mod, two lines up there is a line if($gallery->app->comments_enabled == 'yes') { Your mods will not work unless you have comments_enabled....
So in config.php look for and verify;

$gallery->app->comments_enabled = "yes";
$gallery->app->comments_indication = "both";
$gallery->app->comments_indication_verbose = "no";
$gallery->app->comments_anonymous = "yes";

If that does not work post back.

Dave

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Sun, 2004-05-02 14:06
floridave wrote:
mcgrelio,
If you look at albums.php, where you did the change for this mod, two lines up there is a line if($gallery->app->comments_enabled == 'yes') { Your mods will not work unless you have comments_enabled....
So in config.php look for and verify;

$gallery->app->comments_enabled = "yes";
$gallery->app->comments_indication = "both";
$gallery->app->comments_indication_verbose = "no";
$gallery->app->comments_anonymous = "yes";

Commnents were enabled on my gallery but comments_indication was set to "photos" and not "both". After having changed that to "both" it works.
Now I want the "[" and the counter to be binded to the css. Those characters are red while i want them (except for the "*") looking like the css tells.
Any ideas?
BTW... THX A LOT! :)

 
mcgrelio
mcgrelio's picture

Joined: 2003-02-03
Posts: 52
Posted: Sun, 2004-05-02 14:12
mcgrelio wrote:
Now I want the "[" and the counter to be binded to the css. Those characters are red while i want them (except for the "*") looking like the css tells.
Any ideas?

Ok i got it, it was simple. I deleted the <font> tag in the code ;)

Now i have 2 other questions:
1. is it possible to see only the albums and photos with comments excluding those containing no comments? how?
2. obviously the hack shows also the hidden albums, though nobody can enter and watching the photos without the right permissions, but, is it possible to completely hide them?

Thx, cya ;)

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2004-05-02 16:34
mcgrelio wrote:
Now i have 2 other questions:
1. is it possible to see only the albums and photos with comments excluding those containing no comments? how?

If you look on your page your album called upload does not have any comments. So it does not have a link to the comments page.
Or do you mean you want to have a page with just comments? If so there is a great mod called stats.php. It will allow you to have comments sorted in order as well as most comments etc... Check it out:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=13560&highlight=stats

mcgrelio wrote:
2. obviously the hack shows also the hidden albums, though nobody can enter and watching the photos without the right permissions, but, is it possible to completely hide them?

I don't have many hidden albums so I will have to experiment. But the mod only shows the link if the user can view the album if (!$gallery->user->canReadAlbum($gallery->album)) { Can you explain a bit more. You could change the code to say logged in if you wish.

Dave