Hi there,
I´m trying to hide one or better more extra fields form guests.
I found this article which should be the solution but for some reason I can´t make it work:
community.getk2.org/forum/topics/restrict-extra-field-not
I'm using J1.7.3 with k2 2.5.4
I created an override and replaced existing extra field code in the file templates/"my template"/html/com_k2/templates/"my override"/item.php with the code given in the article above.
Switching to my override all I get is a blank screen. Of course I also put in the correct name of the extra field I want to hide. Is it maybe because of the german language pack
(german expression for guest needed)? Is something missing in the code?
I would highly appreciate any help!
Thanks in advance, Ben
I´m trying to hide one or better more extra fields form guests.
I found this article which should be the solution but for some reason I can´t make it work:
community.getk2.org/forum/topics/restrict-extra-field-not
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="k2ExtraFields">
<h3><?php echo JText::_('Additional Info'); ?></h3>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField):?>
<!-- insert code to test for registared and wether or not to skip here Replace HideField2 with name of your extra field-->
<?php $user =& JFactory::getUser(); ?>
<?php if($extraField->name == "HideField2" && $user->get('guest') ==1) { ?>
<!-- prove it works - delete the text below after testing -->
field omitted
<?php } else { ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="k2ExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="k2ExtraFieldsValue"><?php echo $extraField->value; ?></span>
</li>
<?php } ?>
<?php endforeach; ?>
I'm using J1.7.3 with k2 2.5.4
I created an override and replaced existing extra field code in the file templates/"my template"/html/com_k2/templates/"my override"/item.php with the code given in the article above.
Switching to my override all I get is a blank screen. Of course I also put in the correct name of the extra field I want to hide. Is it maybe because of the german language pack
(german expression for guest needed)? Is something missing in the code?
I would highly appreciate any help!
Thanks in advance, Ben