• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 custom user fields

squirrly

Active member
#1
I'm currently displaying 3 custom user fields in the postbit on all threads/posts. There's two more I'd like to display, but only on certain nodes. Any way to do that? Conditionals?

Here's the code I'm currently using:
Code:
            <xen:if is="@messageShowCustomFields AND {$user.customFields}">
            <xen:hook name="message_user_info_custom_fields" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
           
                <xen:foreach loop="$userFieldsInfo" key="$fieldId" value="$fieldInfo">
                    <xen:if is="{$fieldInfo.viewable_message}">
                        <xen:if hascontent="true">
                            <dl class="pairsJustified userField_{$fieldId}">
                                <dt>{xen:helper userFieldTitle, $fieldId}:</dt>
                                <dd><xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}</xen:contentcheck></dd>
                            </dl>
                        </xen:if>
                    </xen:if>
                </xen:foreach>
               
            </xen:hook>
            </xen:if>
 

Brogan

XenForo moderator
Staff member
#2
You can try using a conditional statement utilising the node IDs: <xen:if is="in_array({$forum.node_id}, array(x, y, z))"> for true, <xen:if is="!in_array({$forum.node_id}, array(x, y, z))"> for false.
 

squirrly

Active member
#3
That's going to be all or nothing for the custom fields, right? Since I have two groups (3 are safe for all nodes, 2 are safe only for some), I need another set of conditionals, I think.