CustomField for logged in viewers only.
|
lnxusr
Joined: 2009-09-06
Posts: 5 |
Posted: Mon, 2009-09-07 06:15
|
|
I'm trying to make the fields from the CustomFields module viewable only by logged in viewers. I've tried wrapping the entire {if !empty($block.customfield.LoadCustomFields.fields)} if statement in the CustomFields.tpl file in an {if $user.isRegisteredUser} statement, but that didn't do anything. In fact if I delete the entire file, the thing still shows the field - even after clearing the template cache. I'm working on a local server, so no link for that. PHP info is rather long, but it's version 5.2.6 and Gallery is working fine. G2/system information: Gallery URL = http://vmserver/gallery2/main.php |
|
| Login or register to post comments |

Posts: 17308
I eddited /modules/customfields/templates/blocks/CustomFields.tpl
Added:
{if $user.isRegisteredUser}
to the top of the file and
{/if} to the bottom. Seems to work for me.
See: http://www.langleycom.com/gallery2/main.php
note you can't see the custom field at the bottom of the album page.
Now login: fred/fred
You will now see the custom field displayed.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 5
Thanks for the quick reply Dave,
That sort of works. My original mod above worked as well, but the custom field shows up in the summary under the thumbnail for guest viewers regardless. That's why I thought it wasn't working and why, when I deleted the CustomField.tpl file, it was still showing up. Evidently CustomField.tpl is only for the detail view. What I need to know is where the field is being displayed in the summary so I can wrap that in an if statement as well.
Johnny..
Posts: 17308
I can't remember how the custom fields are shown under the thumbs. I have not used custom fields for years.
try to see if it show up as a summary:
edit modules/core/templates/blocks/ItemInfo.tpl
<div class="summary-{$name} summary"> {$summary} </div>Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 5
Thanks Dave,
Making the following changes (bold) in the last if statement (line 40) did the trick.
{if !empty($showSummaries)} {if $user.isRegisteredUser} {foreach from=$item.itemSummaries key=name item=summary} <div class="summary-{$name} summary"> <h6>{$summary}</h6> </div> {/foreach} {/if} {/if}