I appreciate the response. My cache_html folder is empty.
`
user@domain:/var/www/gallery/cache_html$ ls -l *
albums:
total 0
images:
total 0
pages:
total 0
rss:
total 0
`
I setup the permissions for "Options -> Gallery -> Gallery Type" set to "Private".
I'd like to take a look at an album comment with you if you don't mind (image comments are broke in the same way). Album permissions appear to be alright, and the best way I can show you is by taking a look at the DB itself.
`
mysql> select * from zp_albums where id in (663, 251, 18) \G
*************************** 1. row ***************************
id: 18
parentid: NULL
folder: Grandpa
title: Grandpa
desc:
date: 2012-08-03 20:28:38
updateddate: 2012-08-22 22:08:48
location:
show: 1
closecomments: 0
commentson: 1
thumb: 1
mtime: 1348140067
sort_type:
subalbum_sort_type:
sort_order: NULL
image_sortdirection: 0
album_sortdirection: 0
hitcounter: 38
password:
password_hint: NULL
publishdate: 2012-08-03 20:28:38
expiredate: NULL
total_value: 0
total_votes: 0
used_ips: NULL
custom_data:
dynamic: 0
search_params: NULL
album_theme: NULL
user: NULL
rating: NULL
rating_status: 3
watermark:
watermark_thumb:
owner: Grandpa
codeblock: a:0:{}
*************************** 2. row ***************************
id: 251
parentid: 18
folder: Grandpa/2012
title: 2012
desc: Photo's and videos taken in 2012.
date: 2012-09-01 11:12:35
updateddate: 2012-09-30 22:06:07
location:
show: 1
closecomments: 0
commentson: 1
thumb: 1
mtime: 1349377477
sort_type:
subalbum_sort_type:
sort_order: NULL
image_sortdirection: 0
album_sortdirection: 0
hitcounter: 0
password:
password_hint: NULL
publishdate: 2012-09-01 11:12:35
expiredate: NULL
total_value: 0
total_votes: 0
used_ips: NULL
custom_data:
dynamic: 0
search_params: NULL
album_theme: NULL
user: NULL
rating: NULL
rating_status: 3
watermark:
watermark_thumb:
owner: NULL
codeblock: a:0:{}
*************************** 3. row ***************************
id: 663
parentid: 251
folder: Grandpa/2012/Blessing
title: Blessing
desc:
date: 2012-09-02 11:13:17
updateddate: 2012-09-02 11:18:40
location:
show: 1
closecomments: 0
commentson: 1
thumb: 1
mtime: 1347824674
sort_type:
subalbum_sort_type:
sort_order: NULL
image_sortdirection: 0
album_sortdirection: 0
hitcounter: 1
password:
password_hint: NULL
publishdate: 2012-09-02 11:13:17
expiredate: NULL
total_value: 0
total_votes: 0
used_ips: NULL
custom_data:
dynamic: 0
search_params: NULL
album_theme: NULL
user: NULL
rating: NULL
rating_status: 3
watermark:
watermark_thumb:
owner: NULL
codeblock: a:0:{}
3 rows in set (0.00 sec)
mysql> select * from zp_comments where comment like 'Thanks so much for these pictures%'\G
*************************** 1. row ***************************
id: 16
ownerid: 663
name: Derek XXXXXXX
email: derek@XXXXXXX.com
website:
date: 2012-09-16 19:17:01
comment: Thanks so much for these pictures.
inmoderation: 0
type: albums
IP: XXX.XXX.XXX.XXX
private: 0
anon: 0
custom_data: NULL
1 row in set (0.00 sec)
`
To my eye, everything appears to be setup correctly. Maybe there's something simple I'm missing.
Maybe there's something going awry with getLatestComments function in template-functions.php (line 3060)? I see that there is a check to see if the logged in user does not have ADMIN_RIGHTS and within that check, it see if the album isMyItem(LIST_RIGHTS). Well, the album doesn't belong to me, so I wonder if that's where things are getting hung up. Anyways, continuing on...
`
function getLatestComments($number,$type="all",$itemID=0) {
global $_zp_gallery;
$passwordcheck1 = "";
$passwordcheck2 = "";
if (!zp_loggedin(ADMIN_RIGHTS)) {
$rslt = query("SELECT * FROM " . prefix('albums'). " ORDER BY title");
if ($rslt) {
while ($albumcheck = db_fetch_assoc($rslt)) {
$album = new Album(NULL, $albumcheck['folder']);
if($album->isMyItem(LIST_RIGHTS) || !checkAlbumPassword($albumcheck['folder'])) {
$albumpasswordcheck1= " AND i.albumid != ".$albumcheck['id'];
$albumpasswordcheck2= " AND a.id != ".$albumcheck['id'];
$passwordcheck1 = $passwordcheck1.$albumpasswordcheck1;
$passwordcheck2 = $passwordcheck2.$albumpasswordcheck2;
}
}
}
}
`
I'm also noticing how we build the query conditionals ($whereAlbums):
`
case "all":
$whereImages = " WHERE i.show = 1 AND c.ownerid = i.id AND i.albumid = a.id AND c.private = 0 AND c.inmoderation = 0 AND (c.type IN (".zp_image_types("'") ."))".$passwordcheck1;
$whereAlbums = " WHERE a.show = 1 AND c.ownerid = a.id AND c.private = 0 AND c.inmoderation = 0 AND c.type = 'albums'".$passwordcheck2;
break;
`
Looks like in order to view the comment for the example album above the following is required:
zp_albums.show = 1
zp_comments.ownerid = zp_albums.id
zp_comments.private = 0
zp_comments.inmoderation = 0
zp_comments.type = albums
I'm not actually sure what the $passwordcheck2 is doing to the query, but when I get rid of it, bad things happen (mysqld becomes unresponsive and my server crashes). :-)
So, looking at my example, here's what I see:
zp_albums.show = 1 [i](All albums in hierarchy are = 1, true)[/i]
zp_comments.ownerid = zp_albums.id [i](663 = 663, true)[/i]
zp_comments.private = 0 [i](true)[/i]
zp_comments.inmoderation = 0 [i](true)[/i]
zp_comments.type = albums [i](true)[/i]
Seems like the query ought to be working. I'm gathering the query would look something like this after all variables have been evaluated:
"SELECT c.id, i.title, i.filename, a.folder, a.title AS albumtitle, c.name, c.type, c.website,
c.date, c.anon, c.comment FROM zp_comments AS c, zp_images AS i, zp_albums AS a
WHERE a.show = 1 AND c.ownerid = a.id AND c.private = 0 AND c.inmoderation = 0 AND c.type = 'albums' AND a.id != 663
ORDER BY c.id DESC LIMIT 10"
Lengthy, I know. To reproduce:
1.) Set gallery type to "Private"
2.) Create 2 users (besides the admin account)
3.) For each user, create a gallery in which they are the only owner. The permissions of each user should be reflect the following:
`
mysql> select id, user, rights, valid, 'group', prime_album, other_credentials from zp_administrators where user = 'Derek';
+----+-------+-----------+-------+-------+-------------+-------------------+
| id | user | rights | valid | group | prime_album | other_credentials |
+----+-------+-----------+-------+-------+-------------+-------------------+
| 8 | Derek | 271230957 | 1 | group | NULL | NULL |
+----+-------+-----------+-------+-------+-------------+-------------------+
`
4.) Login as user1 and comment on a user2 album and image.
5.) As user1, visit the admin Overview page.
6.) Notice the comments are not showing up in the "Latest 10 Comments" section.
I'm trying to think of anything else that might be causing an issue, but I can't. The actual folders on the filesystem have 777 permissions.
Sorry so lengthy. Just trying to figure things out.