Keyword

How to display extrafields on user.php

  • Steven Johnson
  • Steven Johnson's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 5 months ago #112091 by Steven Johnson
How to display extrafields on user.php was created by Steven Johnson
Any suggestions on how to display extra fields on user.php?

I have tried many or the variations to get the extra code to display but nothing seems to work.
Log in  or Create an account to join the conversation.

  • Andrey Miasoedov
  • Andrey Miasoedov's Avatar
  • Offline
  • Senior Member
More
11 years 5 months ago - 11 years 5 months ago #112092 by Andrey Miasoedov
Replied by Andrey Miasoedov on topic Re: How to display extrafields on user.php
Hello, Steven.

You need to use the following sintax:
<?php echo $item->extraFields->fieldAlias->name; ?>
<?php echo $item->extraFields->fieldAlias->value; ?>

And also add a core hack for make it work in components\com_k2\models\item.php

Add || $task == "user" to extrafields condition (line ~181):

//Extra fields
if (($view == 'item' && $item->params->get('itemExtraFields')) || ($view == 'itemlist' && ($task == '' || $task == 'category') && $item->params->get('catItemExtraFields')) || ($view == 'itemlist' && $task == 'tag' && $item->params->get('tagItemExtraFields')) || ($view == 'itemlist' && ($task == 'search' || $task == 'date') && $item->params->get('genericItemExtraFields')) || $task == "user")
{
$item->extra_fields = K2ModelItem::getItemExtraFields($item->extra_fields, $item);
}

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

  • Steven Johnson
  • Steven Johnson's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 5 months ago #112093 by Steven Johnson
Replied by Steven Johnson on topic Re: How to display extrafields on user.php
Thanks so much for the reply and info.

Everything worked perfectly.

-- Steven

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