Support Forums

Can you limit guest access on viewlisting.php

This is a discussion on Can you limit guest access on viewlisting.php within the Technical Support forums, part of the Technical Support Forums category; Is there a way that I can prevent guest from viewing the actually detailed ad page? I know how to ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 01-14-2009, 09:46 AM   #1
Junior Member
 
Join Date: Jun 2008
Posts: 17
Rep Power: 13
dexignz is on a distinguished road
Default Can you limit guest access on viewlisting.php

Is there a way that I can prevent guest from viewing the actually detailed ad page? I know how to prevent guests from searching by adding the following code.

{if $smarty.session.userlevel != 5}
<a href="linkgoeshere">Link</a>
{/if}

However, I want guest to get a prompt to register if they try to go to the viewlisting.php page.

I see there is an option to ban guests from viewing the whole site, but that restricts too much, I just want to limit access to the members ad. Is this possible?
__________________
v4.0.8 Developer
Ebony Honeys | Adult Classifieds
dexignz is offline  
Old 01-14-2009, 09:49 AM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,397
Rep Power: 136
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

I havent tested this, but you should be able to use the same logic you have in your post and apply it to the whole viewlisting.tpl template.

Basically at the top of the template put your {if $smarty.session.userlevel != 5} and then at the bottom of the template place {else} and then after the else tag add some text to let the visitor know they need to log in to see the ad and then after that add the closing {/if} tag.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 01-14-2009, 08:19 PM   #3
Junior Member
 
Join Date: Jun 2008
Posts: 17
Rep Power: 13
dexignz is on a distinguished road
Default Guest Access Notice Message

Thanks, your suggestion worked. The only thing I need to figure out now is how to add a little message saying "Guest Access Restricted, Please register to view listing". Currently it just shows a blank white page. I want to setup a small notice on the page similar to how the banned members error message on a page is setup. I was unable to find where to add the message. Any suggestions?

I already tried to add it directly under the code but it didn't work.
{if $smarty.session.userlevel != 5}
My Error message
{/if}


Quote:
Originally Posted by Lhotch
I havent tested this, but you should be able to use the same logic you have in your post and apply it to the whole viewlisting.tpl template.

Basically at the top of the template put your {if $smarty.session.userlevel != 5} and then at the bottom of the template place {else} and then after the else tag add some text to let the visitor know they need to log in to see the ad and then after that add the closing {/if} tag.
__________________
v4.0.8 Developer
Ebony Honeys | Adult Classifieds
dexignz is offline  
Old 01-14-2009, 08:27 PM   #4
curmudgeon
 
Join Date: Mar 2006
Posts: 5,397
Rep Power: 136
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

Quote:
Originally Posted by dexignz
Thanks, your suggestion worked. The only thing I need to figure out now is how to add a little message saying "Guest Access Restricted, Please register to view listing". Currently it just shows a blank white page. I want to setup a small notice on the page similar to how the banned members error message on a page is setup. I was unable to find where to add the message. Any suggestions?

I already tried to add it directly under the code but it didn't work.
{if $smarty.session.userlevel != 5}
My Error message
{/if}
As I already mentioned, you need to use an {else} in there.......ie

{if $smarty.session.userlevel != 5}
contents of original template here
{else}
my message here
{/if}
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline  
Old 01-14-2009, 08:52 PM   #5
Junior Member
 
Join Date: Jun 2008
Posts: 17
Rep Power: 13
dexignz is on a distinguished road
Thumbs up

Thanks..my fault. It works perfect. I appreciate your help

Quote:
Originally Posted by Lhotch
As I already mentioned, you need to use an {else} in there.......ie

{if $smarty.session.userlevel != 5}
contents of original template here
{else}
my message here
{/if}
__________________
v4.0.8 Developer
Ebony Honeys | Adult Classifieds
dexignz is offline  
Old 01-14-2009, 10:00 PM   #6
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 1,086
Rep Power: 34
bowers01 is on a distinguished road
Default

you can use this as well:
<script type="text/javascript">
alert("To view this page please register or login! www.yoursite.com")
</script>
__________________
Nick Bowers
68c v4.1.10 Developer Custom Template
bowers01 is offline  
Old 03-26-2009, 02:26 AM   #7
Junior Member
 
Join Date: Mar 2009
Posts: 19
Rep Power: 10
Ldanakos is on a distinguished road
Default

where exactly would you all place the code?
Ldanakos is offline  
Old 03-26-2009, 03:18 AM   #8
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 1,086
Rep Power: 34
bowers01 is on a distinguished road
Default

Quote:
Originally Posted by Ldanakos
where exactly would you all place the code?
{if $smarty.session.userlevel == 5}
<script type="text/javascript">
alert("To view this page please register or login! www.yoursite.com")
</script>
{/if}
put it in the <head>
Then in the body put the template code inside

{if $smarty.session.userlevel != 5}
contents of original template here
{/if}
Havn't tested it though.
Nick
__________________
Nick Bowers
68c v4.1.10 Developer Custom Template
bowers01 is offline  
Old 03-27-2009, 03:31 AM   #9
Junior Member
 
Join Date: Mar 2009
Posts: 19
Rep Power: 10
Ldanakos is on a distinguished road
Default

Ok I think i'm doing something wrong as the pages still show the listings.

I've placed this in all the files head and also above the section in the page.

I try setting it to where the guest can view site it says it's banned. i have it set w/everything on no for guests.
__________________
Developer 4.1.1 - Easy Checkoutv1 - Twitter - Deep blue theme
Ldanakos is offline  
Old 03-27-2009, 07:36 AM   #10
Genius At Work
 
bowers01's Avatar
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 1,086
Rep Power: 34
bowers01 is on a distinguished road
Default

Just tested it then, it works like a charm.
In layout.tpl place this in the <head> section
Code:
{if $body=='viewlisting.tpl'}{if $smarty.session.userlevel == 5}
<script type="text/javascript">
alert("To view this page please register or login! www.yoursite.com")
</script> 
{/if}{/if}
Then in viewlisting(2).tpl use this
Code:
{if $smarty.session.userlevel != 5}
contents of original template here
{/if}
It works on 4.09

Cheers,
Nick
__________________
Nick Bowers
68c v4.1.10 Developer Custom Template

Last edited by bowers01; 03-27-2009 at 09:13 AM.
bowers01 is offline  

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0