Keyword

Displaying K2 user group in a template

  • Mark Schultz
  • Mark Schultz's Avatar Topic Author
  • Offline
  • Junior Member
More
4 years 10 months ago #172316 by Mark Schultz
Displaying K2 user group in a template was created by Mark Schultz
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.

More
4 years 10 months ago - 4 years 10 months ago #172322 by JoomlaWorks
Replied by JoomlaWorks on 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 :)

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 4 years 10 months ago by JoomlaWorks.

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


Powered by Kunena Forum