coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: beerguzzler on March 05, 2007, 09:20:50 PM

Title: Enable View counter for admins only?
Post by: beerguzzler on March 05, 2007, 09:20:50 PM
Hi,

I realise you can turn the View counter off/on in the Thumbnail view config, but is it possible to be able to enable it for admins, whilst disabling it for regular users?

Many thanks.
Title: Re: Enable View counter for admins only?
Post by: Nibbler on March 05, 2007, 09:44:21 PM
Modify include/init.inc.php

find


// Reference 'site_url' to 'ecards_more_pic_target'
$CONFIG['site_url'] =& $CONFIG['ecards_more_pic_target'];


after it, add


$CONFIG['views_in_thumbview'] = GALLERY_ADMIN_MODE ? '1' : '0';
Title: Re: Enable View counter for admins only?
Post by: beerguzzler on March 05, 2007, 10:10:11 PM
Thanks, but all that seems to do is set "Display number of views below the thumbnail" to Yes

Maybe that's my fault. I don't actually have a user base, I've disabled the function for Guests to create accounts.

So my original question should of been, is it possible to disable View counter for Guests but keep active for admins?

Sorry for any mix up. :-[
Title: Re: Enable View counter for admins only?
Post by: Nibbler on March 05, 2007, 10:16:06 PM
Disable it where?
Title: Re: Enable View counter for admins only?
Post by: beerguzzler on March 05, 2007, 10:19:46 PM
On the Thumbnail view. At present when anyone goes to the gallery it doesn't display how many times that image has been viewed. This is exactly what I want. I just wondered if it's then possible to be able to show how many times that image has been viewed once I log in as the administrator?
Title: Re: Enable View counter for admins only?
Post by: Nibbler on March 05, 2007, 10:22:37 PM
I see. The code needs to go under here, not where I said before.


// Test if admin mode
$USER['am'] = isset($USER['am']) ? (int)$USER['am'] : 0;
define('GALLERY_ADMIN_MODE', USER_IS_ADMIN && $USER['am']);
define('USER_ADMIN_MODE', USER_ID && USER_CAN_CREATE_ALBUMS && $USER['am'] && !GALLERY_ADMIN_MODE);


I should really have tested it first.
Title: Re: Enable View counter for admins only?
Post by: beerguzzler on March 05, 2007, 10:30:31 PM
Spot on!!  ;D

Thanks very much