|
|
#1 |
|
Junior Member
Join Date: Jun 2008
Posts: 17
Rep Power: 4 ![]() |
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? |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Mar 2006
Posts: 3,989
Rep Power: 97 ![]() ![]() |
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. (Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free) Set your site apart from the competition with one of my modules...... Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module 68 Classifieds Important Links Customer Area | Issue Tracker | Knowledge Base | User Manuals |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: Jun 2008
Posts: 17
Rep Power: 4 ![]() |
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:
|
|
|
|
|
|
|
#4 | |
|
Moderator
Join Date: Mar 2006
Posts: 3,989
Rep Power: 97 ![]() ![]() |
Quote:
{if $smarty.session.userlevel != 5} contents of original template here {else} my message here {/if}
__________________
Larry. (Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free) Set your site apart from the competition with one of my modules...... Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module 68 Classifieds Important Links Customer Area | Issue Tracker | Knowledge Base | User Manuals |
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jun 2008
Posts: 17
Rep Power: 4 ![]() |
Thanks..my fault. It works perfect. I appreciate your help
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 650
Rep Power: 17 ![]() |
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.09 Developer |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Mar 2009
Posts: 18
Rep Power: 1 ![]() |
where exactly would you all place the code?
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 650
Rep Power: 17 ![]() |
{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.09 Developer |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Mar 2009
Posts: 18
Rep Power: 1 ![]() |
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 |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 650
Rep Power: 17 ![]() |
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}
Code:
{if $smarty.session.userlevel != 5}
contents of original template here
{/if}
Cheers, Nick
__________________
Nick Bowers 68c v4.09 Developer Last edited by bowers01; 03-27-2009 at 09:13 AM. |
|
|
|
| Bookmarks |
| Tags |
| banned users, limit guest access, members ads, viewlisting.php |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can't access v4 Q's & Support page | redstar | v3.1 Questions & Support | 3 | 09-24-2008 08:28 AM |
| if/else statement for Guest viewer | LittleRascal | v3.1 Questions & Support | 4 | 03-05-2008 11:05 PM |
| Allowing Guest Posting | takeshimedia | v3.1 Questions & Support | 0 | 03-09-2007 09:54 AM |
| Admin access query | calaf6 | v3.0 Questions & Support | 10 | 03-31-2006 09:32 PM |