- Posts: 4
COMMUNITY FORUM
Hiding specific extra fields from public
- szecska
- Offline
- New Member
Less
More
11 years 11 months ago #101848
by szecska
Replied by szecska on topic Re: Hiding specific extra fields from public
Thanks for your quick reply.
I would like to make visible the extra fields only for the registered users.
Would you write down to me what should I change in the item.php file exactly?
Thanks.
I would like to make visible the extra fields only for the registered users.
Would you write down to me what should I change in the item.php file exactly?
Thanks.
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
11 years 11 months ago - 11 years 11 months ago #101849
by william white
Replied by william white on topic Re: Hiding specific extra fields from public
The k2 2.5.7 changes would be something like this
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Allow Retistared Users Only -->
<?php $user =& JFactory::getUser(); ?>
<?php if ($user->guest): ?>
guest user cannot see them
<?php else: ?>
<!-- Item extra fields -->
<div class="itemExtraFields">
<h3><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h3>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- szecska
- Offline
- New Member
Less
More
- Posts: 4
11 years 11 months ago #101850
by szecska
Replied by szecska on topic Re: Hiding specific extra fields from public
Thank you William!
It' s working.... :)
It' s working.... :)
Please Log in or Create an account to join the conversation.
- william white
- Offline
- Platinum Member
Less
More
- Posts: 3722
11 years 11 months ago #101851
by william white
Replied by william white on topic Re: Hiding specific extra fields from public
welcome
Please Log in or Create an account to join the conversation.
- Pablo Benitez
- Offline
- New Member
Less
More
- Posts: 9
10 years 2 months ago #101852
by Pablo Benitez
Replied by Pablo Benitez on topic Re: Hiding specific extra fields from public
I'm trying to filter one group of extra field, but the condition is not working. Any idea?
Here is the problem:
((int)($extrafield->group)) == 12
If i put <> the condition is met, and in the echo $extraField->group a 12 is print. This doesn't make sense to me but I'm not a php expert. It should be something silly that I'm missing. Please help!
Here is the problem:
((int)($extrafield->group)) == 12
If i put <> the condition is met, and in the echo $extraField->group a 12 is print. This doesn't make sense to me but I'm not a php expert. It should be something silly that I'm missing. Please help!
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value): ?>
<!-- Allow Retistared Users Only -->
<?php $user =& JFactory::getUser(); ?>
<?php if ($user->guest): ?>
<?php if(((int)($extrafield->group)) == 12): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsLabel">TEST<?php echo $extraField->group; ?>TEST</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
</li>
<?php else: ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsLabel"><?php echo $extrafield->id ?><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
</li>
<?php endif; ?>
<?php else: ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<span class="itemExtraFieldsLabel"><?php echo "86" ?><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
</li>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 2 months ago #101853
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Hiding specific extra fields from public
What does echo $extrafield->group; return.
Have you tried using var_dump() to see all the possible values you can use?
Have you tried using var_dump() to see all the possible values you can use?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.