Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted March 28, 20204 yr 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 March 28, 20204 yr by Kirill N
March 29, 20204 yr 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()
March 29, 20204 yr Author On 3/29/2020 at 11:19 AM, 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.
March 29, 20204 yr @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.
March 29, 20204 yr Author On 3/29/2020 at 2:53 PM, 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! 🙂
March 30, 20204 yr On 3/29/2020 at 5:03 PM, 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.