forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Permissions & Access Rights => Topic started by: hittjw on May 05, 2005, 01:24:46 am

Title: Thumbnails only for nongroup members and login on detail page.
Post by: hittjw on May 05, 2005, 01:24:46 am
I've followed some threads on displaying thumbnails only for unregistered users -- in this question I'd like to display thumbnails only for members who are not a part of a certain group, then when a thumbnail is clicked then go straight to the login page.

This would allow visitors to get an idea of content available, but force them to login for details.

Best,

Justin
Title: Re: Thumbnails only for nongroup members and login on detail page.
Post by: Nibbler on May 05, 2005, 06:02:47 pm
Add into displayimage.php, just after

Code: [Select]
require('include/init.inc.php');
the code
Code: [Select]
if (!in_array(2, $USER_DATA['groups']))
 {
header('Location: http://www.yourdomain.com/path/to/login.php');
exit;
}

where 2 is the group you wish to allow acces to
Title: Re: Thumbnails only for nongroup members and login on detail page.
Post by: hittjw on May 12, 2005, 04:55:43 am
Nibbler,

Thank you so much!  I tuned up your suggestion so it response the same as clicking the "Login" button.  But I still need someway to let people through to albums set to "Everybody" ... because I'm using categories tied to groups, I put this in "thumbnails.php" ... you can see this in action by visiting http://hittpublishingdirect.com/cpg/

After:

Code: [Select]
require('include/init.inc.php');
if ($CONFIG['enable_smilies']) include("include/smilies.inc.php");

I placed:

Code: [Select]
global $REFERER;
if (in_array(3, $USER_DATA['groups']))
{
$redirect = "http://" . $HTTP_SERVER_VARS['HTTP_HOST'];
if (dirname($HTTP_SERVER_VARS['PHP_SELF']) != "/")
$redirect = $redirect . dirname($HTTP_SERVER_VARS['PHP_SELF']) . "/";
if ($REFERER) {
$redirect = $redirect . "login.php?referer=" . $REFERER;
header("Location: $redirect");
exit;
}
$redirect = $redirect . "login.php";
header("Location: $redirect");
exit;
}

It allows all groups execpt "Guests" to see content, "Guests" are asked to login.

I'm now looking for a variable to check to know if an album is public -- if it's set visable to "Everybody" then I want my "Guests" to see it too.  Any ideas?

Sincerely,

Justin