Hi,
I did a minor change in functions.inc.php where the toprated images only show those uploaded in the last 24 hours. However, now when you click on the thumbnail in toprated it either goes to a completely different picture or comes up with "There was an error while processing a database query". Site is www.snapfoto.com/foto. Can anyone help, please?
case 'toprated': // Top rated pictures
if ($cat && $CURRENT_CAT_NAME) {
$album_name = cpg_fetch_icon('top_rated', 2) . $lang_meta_album_names['toprated'] . ' - ' . $CURRENT_CAT_NAME;
} else {
$album_name = cpg_fetch_icon('top_rated', 2) . $lang_meta_album_names['toprated'];
}
$query = "SELECT COUNT(*)
FROM {$CONFIG['TABLE_PICTURES']} AS r
INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
$RESTRICTEDWHERE
AND ctime >= (UNIX_TIMESTAMP()-(24*60*60))
AND approved = 'YES'
AND r.votes >= '{$CONFIG['min_votes_for_rating']}'";
$result = cpg_db_query($query);
list($count) = mysql_fetch_row($result);
mysql_free_result($result);
list($ASC, $DESC, $limit, $flipped) = get_pic_data_ordering($count, $limit1, $limit2);
$select_columns = implode(', ', $select_column_list);
$query = "SELECT $select_columns
FROM {$CONFIG['TABLE_PICTURES']} AS r
INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
$RESTRICTEDWHERE
AND ctime >= (UNIX_TIMESTAMP()-(24*60*60))
AND approved = 'YES'
AND r.votes >= '{$CONFIG['min_votes_for_rating']}'
ORDER BY pic_rating $DESC, r.votes $DESC, pid $DESC
$limit";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
if ($flipped) {
$rowset = array_reverse($rowset);
}
if ($set_caption) {
build_caption($rowset, array('pic_rating'));
}
$rowset = CPGPluginAPI::filter('thumb_caption_toprated', $rowset);
return $rowset;
break;
Have you also adjusted the code in function get_pic_pos? If not, you need to do so.
Thanks Andre -done!