1. 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

Discussion in 'Styling and Customization Questions' started by squirrly, Aug 2, 2014.

  1. squirrly

    squirrly Active Member

    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:
                <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>
  2. Brogan

    Brogan XenForo Moderator Staff Member

    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.
  3. squirrly

    squirrly Active Member

    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.

Share This Page