Where exactly in the two Select statements?...I added it at the end on both and got an error, ie:
$albumcount = $db->query_first("
SELECT COUNT(*) AS total
FROM " . TABLE_PREFIX . "album
WHERE state IN ('" . implode("', '", $state) . "')
AND album.visible > 0
");
I don't think you add that line to the end of the second SELECT statement (you do the first however, and it seems you have correctly done it based on your posted example) - here's how I did mine, on the first SELECT statement I did it just like yours, on the next one I added it right after the WHERE line and before the ORDER line as this made the most sense to me and lo and behold it worked on the first try. See if this helps:
SELECT album.*,
picture.pictureid, picture.extension, picture.idhash,
picture.thumbnail_dateline, picture.thumbnail_width, picture.thumbnail_height,
user.*
FROM " . TABLE_PREFIX . "album AS album
LEFT JOIN " . TABLE_PREFIX . "picture AS picture ON (album.coverpictureid = picture.pictureid AND picture.thumbnail_filesize > 0)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (album.userid = user.userid)
WHERE album.state IN ('" . implode("', '", $state) . "') AND album.visible > 0
ORDER BY $sortname $sortorder
LIMIT $start, $perpage
");
Is that the same error you had before? I'm using this mod on 3.7.2 and the album.visible hack worked just fine, its just another condition thrown into the query. Are you able to access your forum database and see if there is a column called 'visible' in your table named 'album'?
in table vb_album there is a column named visible.
All Columns:
albumid userid createdate lastpicturedate visible moderation title description state coverpictureid
Error Message emailed to me:
Invalid SQL:
SELECT COUNT(*) AS total
FROM vb_album
WHERE state IN ('public', 'private', 'profile')
AND album.visible > 0;
MySQL Error : Unknown column 'album.visible' in 'where clause'
Error Number : 1054
--------------------Added to---------------
$albumcount = $db->query_first("
SELECT COUNT(*) AS total
FROM " . TABLE_PREFIX . "album
WHERE state IN ('" . implode("', '", $state) . "')
AND album.visible > 0
");
------------And--------------
$albums = $db->query_read("
SELECT album.*,
picture.pictureid, picture.extension, picture.idhash,
picture.thumbnail_dateline, picture.thumbnail_width, picture.thumbnail_height,
user.*
FROM " . TABLE_PREFIX . "album AS album
LEFT JOIN " . TABLE_PREFIX . "picture AS picture ON (album.coverpictureid = picture.pictureid AND picture.thumbnail_filesize > 0)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (album.userid = user.userid)
WHERE album.state IN ('" . implode("', '", $state) . "')
AND album.visible > 0
ORDER BY $sortname $sortorder
LIMIT $start, $perpage
");
Okay I think you're getting closer - since you have a table prefix of vb_ try this
$albumcount = $db->query_first("
SELECT COUNT(*) AS total
FROM " . TABLE_PREFIX . "album
WHERE state IN ('" . implode("', '", $state) . "') AND vb_album.visible > 0
");
but leave the second SELECT statement as album.visible don't change that one to vb_album.visible and see what happens
Okay I think you're getting closer - since you have a table prefix of vb_ try this
$albumcount = $db->query_first("
SELECT COUNT(*) AS total
FROM " . TABLE_PREFIX . "album
WHERE state IN ('" . implode("', '", $state) . "') AND vb_album.visible > 0
");
but leave the second SELECT statement as album.visible don't change that one to vb_album.visible and see what happens