Hi, I used this mod on cpg 1.4 and I tried to add it back now after I upgrated to 1.5 but I could not do it all right.
http://forum.coppermine-gallery.net/index.php/topic,52809.0.htmlmy gallery is
http://xoxos4u.commost viewed albums link
http://xoxos4u.com/thumbnails.php?album=topnalbPlease note that I have 0 knowledge of php and I just guessed my way until here.
The albums do show up but when I click on one of the image doesn't take me to the intermediate image its going to the same page and thats because there is a part of code in theme.php that I have no idea how to change.
I will write first everything I changed and the last the part I got stucked with.
Files to edit:
index.php
include/functions.inc.php
lang/english.php (repeat for all the desired language files)
themes/your_theme/theme.php
open
index.php
find
case 'alblist':
list_albums();
break;
add after
case 'topnalb':
display_thumbnails('topnalb', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
break;
open
include/functions.inc.php
$rowset = CPGPluginAPI::filter('thumb_caption_favpics', $rowset);
return $rowset;
break;
after add
case 'topnalb': // Last albums to which uploads
if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
$album_name = $lang_meta_album_names['topnalb'].' - '. $CURRENT_CAT_NAME;
} else {
$album_name = $lang_meta_album_names['topnalb'];
}
$META_ALBUM_SET_MWA = str_replace( "aid", $CONFIG['TABLE_PICTURES'].".aid" , $META_ALBUM_SET );
$query = "SELECT count({$CONFIG['TABLE_ALBUMS']}.aid) FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET_MWA GROUP BY {$CONFIG['TABLE_PICTURES']}.aid";
$result = cpg_db_query($query);
$count = mysql_num_rows($result);
mysql_free_result($result);
$query = "SELECT *, SUM({$CONFIG['TABLE_PICTURES']}.hits) AS hits, {$CONFIG['TABLE_ALBUMS']}.title AS title, {$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_ALBUMS']},{$CONFIG['TABLE_PICTURES']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND {$CONFIG['TABLE_PICTURES']}.approved = 'YES' AND hits > 0 $META_ALBUM_SET_MWA GROUP BY {$CONFIG['TABLE_ALBUMS']}.aid ORDER BY hits DESC $limit";
$result = cpg_db_query($query);
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
if ($set_caption) build_caption($rowset,array('hits'));
$rowset = CPGPluginAPI::filter('thumb_caption_topnalb',$rowset);
return $rowset;
break;
Open
lang/english.php
find
$lang_meta_album_names['favpics'] = 'Favorite files';
add after
$lang_meta_album_names['topnalb'] = 'Most viewed Albums';
OPEN
themes/your_theme/theme.php
FIND
function theme_display_thumbnails
(if absent, copy and paste it from themes/sample/theme.php)
$album_types = array(
'albums' => array('lastalb')
);
replace with
$album_types = array(
'albums' => array('lastalb' || $aid == 'topnalb')
);
And now the part I believe I have to edit but not sure how
in 1.5 cpg is like this:
$i = 0;
global $thumb; // make $thumb accessible to plugins
foreach($thumb_list as $thumb) {
$i++;
if ($mode == 'thumb') {
if (in_array($aid, $album_types['albums'])) {
$params = array(
'{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
'{THUMB}' => $thumb['image'],
'{CAPTION}' => $thumb['caption'],
'{ADMIN_MENU}' => $thumb['admin_menu'],
);
and in cpg 1.4
$i = 0;
foreach($thumb_list as $thumb) {
$i++;
if ($mode == 'thumb') {
if ($aid == 'lastalb' || $aid == 'topnalb') {
$params = array('{CELL_WIDTH}' => $cell_width,
'{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
'{THUMB}' => $thumb['image'],
'{CAPTION}' => $thumb['caption'],
'{ADMIN_MENU}' => $thumb['admin_menu']
);
Thanks in advance!