Jump to content

Recommended Posts

Posted (edited)

Hey guys! Hope everyone is well!

I'm working on a theme for my website and I'm struggling with adding a custom profile field to the postContainer template.

I know the code for custom fields in Pages is this

{{if $record->field_51}}
{$record->customFieldDisplayByKey('key', 'listing')|raw}
{{endif}}

 

What would be the equivalent for this code for custom profile fields?

 

Thanks in advance! 

Edited by Kirill N
Posted

Hello,

Quote
  • $member->profileFields(): Return the custom profile fields for the member as an array of profile field objects.
  • $member->contentProfileFields(): This is similar to profileFields() but instead only returns profile fields designed to display next to the user's content (e.g. in the left sidebar next to a post)

Change $member to $comment->author()

Posted
13 minutes ago, newbie LAC said:

Hello,

Change $member to $comment->author()

Many thanks for the response, I appreciate it.

Unfortunately {$comment->author()->contentProfileFields()} doesn't return anything. I also need to return a specific custom field, not all of them.

Posted
2 hours ago, Morrigan said:

@Kirill N


$comment->author()->contentProfileFields()[core_pfieldgroups_#][core_pfield_#]

The first one is the field group and the second one is the field itself. You'll need the ID.

This was perfectly! Thank you so so much. Please PM me your paypal address so I can buy you a coffee! 🙂

Posted
22 hours ago, Kirill N said:

This was perfectly! Thank you so so much. Please PM me your paypal address so I can buy you a coffee! 🙂

You're welcome. I put my paypal.me in my signature. ❤️ Glad it worked.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...