Keyword

Displaying K2 user group in a template

  • Mark Schultz
  • Mark Schultz's Avatar Topic Author
  • Offline
  • Junior Member
More
3 weeks 7 hours ago #172316 by Mark Schultz
Mark Schultz created the topic: Displaying K2 user group in a template
Just figured out how to display an author's K2 user group, thought I'd share in case it's helpful to anyone...

$this->item->author->profile->group is the group id number in the table k2_user_groups, an example:

<?php if($this->item->author->profile->group == 3): ?>
<?php echo "label for group 3"; ?>
<?php elseif($this->item->author->profile->group == 2): ?>
<?php echo "label for group 2"; ?>
<?php endif; ?>

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

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 6 days ago - 2 weeks 6 days ago #172322 by Fotis
Fotis replied the topic: Displaying K2 user group in a template
Thanks for sharing Mark!

I believe we can add the group name as well in the next release of K2 to make things easier for developers :)

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member
Last edit: 2 weeks 6 days ago by Fotis.

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

Moderators: william white

Powered by Kunena Forum