Hi Krikor.
Thank you for your patience.
I have read the Accessing the current user object
I don't have a very well developed understanding of, or ability to write, php so I was hoping for a little more help please.
If I have an extra field "item_name" that I only want to be visible to "Publishers", for example, how would the github cheatsheet code, the user object code and the extra field code in item.php all go together to achieve this?
UPDATE:
As the User Object seems only to function in determining whether the user is a guest or not, I assume that I will have to make all items visible by using the cheatsheet method for all viewers.
So I am looking at something like the following:
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<?php $user = JFactory::getUser();
if ($user->guest): ?>
<?php
if( isset( $this->item->extraFields->EXTRAFIELDALIASHERE->value ) && ( $this->item->extraFields->EXTRAFIELDALIASHERE->value !== '') )
{
$this->item->extraFields->EXTRAFIELDALIASHERE->name;
$this->item->extraFields->EXTRAFIELDALIASHERE->value;
}
?>
<?php else>
<?php
if( isset( $this->item->extraFields->EXTRAFIELDALIASHERE->value ) && ( $this->item->extraFields->EXTRAFIELDALIASHERE->value !== '') )
{
$this->item->extraFields->EXTRAFIELDALIASHERE->name;
$this->item->extraFields->EXTRAFIELDALIASHERE->value;
}
?>
Can you help me organise that code so that it works please?
Many thanks
Edited 10 years 7 months ago by Deborah · Reason: update