[view comments] for all users...

quadris

Joined: 2003-07-09
Posts: 27
Posted: Fri, 2003-09-05 11:05

hi all!

i want to have that erverybody can see this button...[view comments]

or

a better way is, under "this album have been viewed xx times", should bee printed "This album have xx comments"

i hope that the second thing is possible, if not, help me with the first question!

greats,
quadris

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Fri, 2003-09-12 07:56

1) Everyone see the link:

In albums.php, find this 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&amp;comments") ?>]</a>
   <?php } ?>

Move the "view comments" link line out of the "admin" if {} block.

Search for "comment" in view_album.php and you'll find similar code. Again, move the line out of the if {} block which checks for admin status, and everyone will see it.

*Then*, you need to remove the "hack check" code from view_comments.php:

// Hack check
if (!$gallery->user->isAdmin() && !$gallery->user->isOwnerOfAlbum($gallery->albu
m)) {
        header("Location: albums.php");
        return;
}

2) This album has "XX" comments:

This requires more customization. If you're willing to code it, let me know, and I'll help point you in the right direction of how to approach this.

-Beckett (

)

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Mon, 2003-10-13 14:49

Hi. Sounds like you want to have a go at 2).

Basically, you'll need to loop through each item in the given album, and for each image/movie item, you'll add up the number of comments for that item. Assuming you'd want this to go in view_album.php. The code would look something like this:

$numComments = 0;
for ($i=0; $i<$numPhotos; $i++) {
   $numComments += $gallery->album->numComments($i);
}
sprintf("This album has %d comments", $numComments);

-Beckett (

)

 
joan
joan's picture

Joined: 2002-10-21
Posts: 3473
Posted: Mon, 2003-10-13 16:46

Just thought I'd point out, that in 1.4.1 (due out shortly) you can have each album include "Last comment <date>" underneath, which is not a bad way of knowing where to look for new comments.

 
quadris

Joined: 2003-07-09
Posts: 27
Posted: Tue, 2003-10-14 07:42

but i dont want to update to 141...
is there another way?

greats,
quadris

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2003-10-14 09:00

Er... what have you tried so far? Was my explanation above not clear enough?

-Beckett (

)

 
quadris

Joined: 2003-07-09
Posts: 27
Posted: Wed, 2003-10-15 06:04

sorry, i do not really understand it...
my english is no good... :(

so, i only have to insert this code in the view_album.php????
and where?

greats,
quadris

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Fri, 2003-11-14 11:09

It would go in wherever you want the text to appear. I'll give you a specific answer if you ask a specific question.

-Beckett (

)