Keyword

Extened field for registered users

  • Bojan Jovanovic
  • Bojan Jovanovic's Avatar Topic Author
  • Offline
  • New Member
More
9 years 5 months ago #134856 by Bojan Jovanovic
Extened field for registered users was created by Bojan Jovanovic
Hello,

I love the ability to add extra fields for specific categories, but I need to show extra fields for Items only for registered (logged-in) users.

How to achieve that?

Thanks!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 5 months ago #134873 by Krikor Boghossian
Replied by Krikor Boghossian on topic Extened field for registered users
You can render extrafields directly in your template.
<?php if(isset($this->item->extraFields->ALIAS->value)): ?>         
<?php echo $this->item->extraFields->ALIAS->value; ?>
<?php endif; ?>

Then you can check if the user is logged in and perform the appropriate action.
You can do this with Joomla!'s user funtions.
docs.joomla.org/Accessing_the_current_user_object

Be careful that someone rendering your site with another template he might still be able to see the extrafields.

PS. You should override your template. More info can be found here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum