4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: rohanrohanrohan on June 05, 2003, 12:42:29 PM

Title: Restriction of Guest access?
Post by: rohanrohanrohan on June 05, 2003, 12:42:29 PM
I have a large gallery and there are lots of guest browsing the thumbs, which I dont want.

I know hiding the cat names will not allow to see thumbs but i dont want this.

I  guests to see the category names but not allow guests to see the thumbs.

Is there any way to do this?

from first inspection of the code i guess i can remove the "if cats" statement in the home page and simply show the cats.

but am not sure. plz help.

thanks.
Title: Restriction of Guest access?
Post by: V@no on June 05, 2003, 01:04:00 PM
u can do it in two ways:
1. if u want only restrict the thumbnails and nothing else, u can do this:
in /includes/functions.php find:
Code: [Select]
"thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link),replace it with:
Code: [Select]
"thumbnail" => ($user_info['user_level'] == GUEST) ? "" : get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link),

2. if u want disable also something else (atleast in templates), then u could do this:
in /includes/page_header.php find:
Code: [Select]
"media_url" => MEDIA_PATH,add before:
Code: [Select]
"notguest" => ($user_info['user_level'] == GUEST) ? 0 : 1,
After that u can use in your templates this format:
Quote
{if notguest}
...
whatever u want display if not a guest
...

{endif notguest}

in your case, u can disable the thumbnails by adding {if notguest} and {endif notguets} around the {thumbnail} tag in thumbnails_bit.html template
Title: Restriction of Guest access?
Post by: rohanrohanrohan on June 05, 2003, 03:00:37 PM
thanks a lot man! will try it now!
Title: Restriction of Guest access?
Post by: toto1 on June 06, 2003, 09:16:02 AM
v@no is you he possible to post the images by default of 4 images jpg GIF zip swf etc.... has the place of the thumnbails

guest =
(http://www.gifanimer.com/templates/imagine/icons/jpg.gif)

after register =

register =
(http://www.gifanimer.com/data/thumbnails/34/90.jpg)
Title: Restriction of Guest access?
Post by: rohanrohanrohan on June 06, 2003, 11:10:04 AM
yeah tahts also a good idea! is it possible?
Title: Restriction of Guest access?
Post by: V@no on June 06, 2003, 11:14:35 AM
try this:
in /includes/functions.php find:
Code: [Select]
global $site_sess, $config;
replace with
Code: [Select]
global $site_sess, $config, $user_info;
then, find:
Code: [Select]
if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
replace with:
Code: [Select]
if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0) || $user_info['user_level'] == GUEST) {
this should disable all thumbnails from showing to GUESTs
Title: Restriction of Guest access?
Post by: toto1 on June 06, 2003, 11:34:38 AM
excellent maitre v@no thk :D
Title: Restriction of Guest access?
Post by: toto1 on June 06, 2003, 11:44:18 AM
is possible :

exemple :
Categorie : Avion =  acces guest  option in Cp = visualise = all
possible visualise thumnbail in the categorie.

Categorie : moto = acces members option in cp = visualise = members
possible is members visualise thumnbail and no guest. Guest visualise default images 4images

Is possible maitre v@no
thk

sorry for my english is french.
Request forum french in international forum 4images :?:
Title: Restriction of Guest access?
Post by: V@no on June 06, 2003, 12:23:57 PM
Quote from: toto1
is possible :

exemple :
Categorie : Avion =  acces guest  option in Cp = visualise = all
possible visualise thumnbail in the categorie.

Categorie : moto = acces members option in cp = visualise = members
possible is members visualise thumnbail and no guest. Guest visualise default images 4images

yes, but u'll need new field in 4images_categories table in the DB.
then, do changes in /admin/  atleast two files, and again do changes in functions.php
but for now, the "dirty" way is do this way:
the line from my previous post:
Code: [Select]
if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0) || $user_info['user_level'] == GUEST) { replace with:
Code: [Select]
   $cat_array = array(xx, xx, xx);
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0) || ($user_info['user_level'] == GUEST && in_array($cat_id, $cat_array))) {

Replace xx with as many categories IDs where u want show icon for guests.
Title: Restriction of Guest access?
Post by: toto1 on June 06, 2003, 10:12:54 PM
yes very good thk v@no

is possible to case option in admin CP for choise visible or no visible for guest.

very thk
Title: Restriction of Guest access?
Post by: V@no on June 07, 2003, 04:51:34 PM
Quote from: V@no
2. if u want disable also something else (atleast in templates), then u could do this:
in /includes/page_header.php find:
Code: [Select]
"media_url" => MEDIA_PATH,add before:
Code: [Select]
"notguest" => ($user_info['user_level'] == GUEST) ? 0 : 1,
After that u can use in your templates this format:
Quote
{if notguest}
...
whatever u want display if not a guest
...

{endif notguest}

in your case, u can disable the thumbnails by adding {if notguest} and {endif notguets} around the {thumbnail} tag in thumbnails_bit.html template

hmmm...thanks to SLL for finding, that all this already exist in /includes/page_header.php
u can use those tags in your templates:
{if user_loggedin} .... {endif user_loggedin}
or
{if user_loggedout} .... {endif user_loggedout}
no need do any changes in the code...:D