Support Forums

Showing Specific Extra Fields to Guest in Listing View

This is a discussion on Showing Specific Extra Fields to Guest in Listing View within the Technical Support forums, part of the Technical Support Forums category; I have 6 extra fields I've created. 3 of those 6 extra fields I don't want Guests to see when ...


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 05-06-2009, 04:02 PM   #1
Member
 
Join Date: Apr 2009
Posts: 32
Rep Power: 6
hotchops is on a distinguished road
Default Showing Specific Extra Fields to Guest in Listing View

I have 6 extra fields I've created. 3 of those 6 extra fields I don't want Guests to see when they view a listing. I want all 6 to show up for Registered Users when they view a listing.

I have this code to input for the viewlisting.tpl file in order to control who can see all or none of the 6 extra fields:

{* Extra Fields *}
{if $smarty.session.userlevel==1 || $smarty.session.userlevel==3}
{/if}

But I need I need more control than just showing all or none of the extra fields.

I see this code below but am not sure what to do in order to be selective in order to show only 3 extra fields to Guest and all 6 extra fields to Registered Users:
<tr>
<td><strong>{$extras.title}:</strong></td>
<td>
{if isset($extras.value)}
{foreach key=key item=item from=$extras.value}
{$item|nl2br}<br />
{foreachelse}
{$extras.value}
{/foreach}
{/if}
</td>
</tr>

Thanks for the help!
__________________
Version 4.1.2 Designer / NuStyle Charcoal by TemplateCodes
hotchops is offline  
Old 05-06-2009, 04:09 PM   #2
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,472
Rep Power: 131
Eric Barnes is just really nice Eric Barnes is just really nice
Default

You can probably use this plugin which may be easier:
Get Extra Field - 68 Classifieds
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Old 05-06-2009, 04:15 PM   #3
Member
 
Join Date: Apr 2009
Posts: 32
Rep Power: 6
hotchops is on a distinguished road
Default

Thanks! I'm still a bit confused, sorry. Can you show me an example of how that plugin would look incorporated in the viewlisting.tpl?
__________________
Version 4.1.2 Designer / NuStyle Charcoal by TemplateCodes
hotchops is offline  
Old 05-06-2009, 04:20 PM   #4
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,472
Rep Power: 131
Eric Barnes is just really nice Eric Barnes is just really nice
Default

How about this:
Code:
// Hide extra field id #1 from guests
{if $smarty.session.userlevel < 3}
Field Title: {get_extra_field id=$view fid=1}
{/if} 
// Field 2 everyone can see:
Field Title: {get_extra_field id=$view fid=2}
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Old 05-06-2009, 04:27 PM   #5
Member
 
Join Date: Apr 2009
Posts: 32
Rep Power: 6
hotchops is on a distinguished road
Default

Cool, thank you. So it would look like...

{* Extra Fields *}
{if $smarty.session.userlevel < 3}
Field Title: {get_extra_field id=$view fid=1}
{/if}
__________________
Version 4.1.2 Designer / NuStyle Charcoal by TemplateCodes
hotchops is offline  
Old 05-09-2009, 07:31 PM   #6
Member
 
Join Date: Apr 2009
Posts: 32
Rep Power: 6
hotchops is on a distinguished road
Default

I am having problems with this plugin. I've plugged the code on both viewlistings tpl files but it has no effect. I'm confused? This is how I wrote it in both files

{* Extra Fields *}
{if $smarty.session.userlevel < 3}
Field Title: {get_extra_field id=$view fid=1}
{/if}
__________________
Version 4.1.2 Designer / NuStyle Charcoal by TemplateCodes
hotchops is offline  
Old 05-09-2009, 08:20 PM   #7
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,973
Rep Power: 58
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Quote:
Originally Posted by hotchops
I am having problems with this plugin. I've plugged the code on both viewlistings tpl files but it has no effect. I'm confused? This is how I wrote it in both files

{* Extra Fields *}
{if $smarty.session.userlevel < 3}
Field Title: {get_extra_field id=$view fid=1}
{/if}
The code as you have it will output exactly this:
Field Title: XXXX

Where XXXX is the value that is in the extra field ID1 in that particular listing. Are you perhaps looking at a listing that doesn't have anything in that field? Are you logged in as either the admin or a registered user when testing your viewing of the ad listing?

I would also suggest that you change "Field Title:" To the actual name of the extra field that is ID1.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline  
Old 05-09-2009, 09:34 PM   #8
Member
 
Join Date: Apr 2009
Posts: 32
Rep Power: 6
hotchops is on a distinguished road
Default

I am viewing the listing on another computer entirely and not logged in as a guest. I have changed "Field Name" to whatever the actual field name is.

My problem lies with the fact that if I do call the field with just this it shows up for guests, registered users, admins...just fine:
Dimensions: {get_extra_field id=$view fid=1}

But it won't show up for a registered user when I add this before it.
{if $smarty.session.userlevel < 3}

Also I need these to show up below the other general fields. They are showing up above them, right under the pictures in the listing.

Thanks for the help!
__________________
Version 4.1.2 Designer / NuStyle Charcoal by TemplateCodes
hotchops is offline  
Old 05-09-2009, 11:38 PM   #9
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,973
Rep Power: 58
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Perhaps it doesn't like the "<"

Try it this way:
{* Extra Fields *}
{if $smarty.session.userlevel == 1 || $smarty.session.userlevel == 2}
Field Title: {get_extra_field id=$view fid=1}
{/if}

As far as where it shows up, that's dependent on where you place the code itself.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline  
Old 05-10-2009, 11:14 PM   #10
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,472
Rep Power: 131
Eric Barnes is just really nice Eric Barnes is just really nice
Default

Also you can add something like this to see what actual userlevel you are viewing it.
Code:
Field Title: {get_extra_field id=$view fid=1}
My Level: {$smarty.session.userlevel}
Then compare the number to later use in the if statement.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extra Fields Showing Up On Search Page hotchops Technical Support 6 04-30-2009 09:34 PM
Extra Fields In Listin View hotchops Technical Support 6 04-30-2009 07:53 PM
Extra Fields On View Listing Page dexignz Technical Support 1 09-23-2008 09:01 AM
extra fields in category view bholdman Modules / Plugins / Modifications 2 05-15-2008 07:12 PM


All times are GMT -4. The time now is 12:25 AM.


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