XF 2.0 Requesting help with custom user fields

Matt C.

Well-known member
So I have a template called "ah_gamerprofiles_macros".

The contents of that template are (I've omitted some of the code belonging to the other custom user fields for simplistic reasons):
HTML:
<xf:macro name="ah_gamerprofiles_icons" arg-user="!">
    <xf:css src="ah_gamerprofiles.less" />

    <xf:set var="$ahGPStatus" value="{{ property('ahGPStatus') }}" />
    <xf:if contentcheck="true">
        <div class="ah-gp-icons-container">
        <xf:contentcheck>

            <xf:comment>PlayStation</xf:comment>
            <xf:if is="{$user.Profile.custom_fields.ah_playstation} AND $ahGPStatus.ah_playstation">
                <a href="https://gamercards.exophase.com/psn/user/{$user.Profile.custom_fields.ah_playstation}" class="ah-gp-trigger" target="_blank">
                    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 26 26" version="1.1" class="ah-gp-svg ah-gp-svg--playstation">
                        <g id="surface1">                              
                            <path style=" " d="M 10 3.5 L 10 21.84375 L 13.96875 23.0625 L 13.96875 7.75 C 13.96875 7.34375 14.019531 7.046875 14.1875 6.875 C 14.355469 6.640625 14.511719 6.617188 14.75 6.71875 C 15.324219 6.886719 15.59375 7.40625 15.59375 8.25 L 15.59375 14.40625 C 16.878906 15.015625 18.03125 15.078125 18.875 14.4375 C 19.753906 13.828125 20.21875 12.746094 20.21875 11.125 C 20.21875 9.433594 19.902344 8.128906 19.15625 7.28125 C 18.480469 6.371094 17.289063 5.640625 15.53125 5.03125 C 13.335938 4.320313 11.488281 3.8125 10 3.5 Z M 8.78125 14.59375 L 8 14.84375 L 3.09375 16.59375 L 2.25 16.9375 C 0.964844 17.476563 0.277344 18.054688 0.3125 18.5625 C 0.378906 19.304688 1.226563 19.84375 2.75 20.25 C 4.726563 20.78125 6.730469 20.902344 8.78125 20.59375 L 8.78125 18.5 L 8 18.78125 L 7.125 19.125 L 5.71875 19.40625 L 4.375 19.25 C 4.105469 19.078125 4.015625 18.886719 4.1875 18.71875 C 4.355469 18.617188 4.605469 18.476563 4.875 18.375 L 5.78125 18.0625 L 8.78125 17 Z M 20.15625 15.5625 C 19.789063 15.546875 19.417969 15.578125 19.0625 15.59375 C 17.75 15.621094 16.402344 15.835938 15 16.28125 L 15 18.75 L 17.78125 17.78125 L 19.21875 17.28125 C 19.21875 17.28125 19.761719 17.136719 20.15625 17.03125 C 20.761719 16.871094 21.40625 17.09375 21.40625 17.09375 C 21.777344 17.125 21.964844 17.265625 22.03125 17.4375 C 22.097656 17.640625 21.851563 17.796875 21.34375 17.96875 L 20.09375 18.46875 L 15 20.28125 L 15 22.6875 L 17.375 21.84375 L 23.09375 19.8125 L 23.78125 19.5 C 25.136719 18.992188 25.753906 18.457031 25.6875 17.78125 C 25.652344 17.136719 24.882813 16.628906 23.53125 16.1875 C 22.390625 15.804688 21.253906 15.605469 20.15625 15.5625 Z "/>
                        </g>
                    </svg>

                    <img src="//card.exophase.com/psn/{$user.Profile.custom_fields.ah_playstation}.png" class="ah-gp-profile" />
                </a>
            </xf:if>
           
        </xf:contentcheck>
        </div>
    </xf:if>
   
</xf:macro>

<xf:macro name="ah_gamerprofiles_message">
    <xf:if is="{$user.Profile.custom_fields.ah_playstation} OR {$user.Profile.custom_fields.ah_xbox} OR {$user.Profile.custom_fields.ah_steam} OR {$user.Profile.custom_fields.ah_twitch} OR {$user.Profile.custom_fields.ah_youtube}">
        <div class="ah-gp-message">
            <xf:macro template="ah_gamerprofiles_macros" name="ah_gamerprofiles_icons" arg-user="{$user}" />
        </div>
    </xf:if>
</xf:macro>

I also have a template modification that edits the message_macros template.

Find:

HTML:
<xf:if is="$extras.custom_fields">
                        <xf:macro template="custom_fields_macros" name="custom_fields_values"
                            arg-type="users"
                            arg-group="personal"
                            arg-set="{$user.Profile.custom_fields}"
                            arg-additionalFilters="{{ ['message'] }}"
                            arg-valueClass="pairs pairs--justified" />
                        <xf:if is="$user.canViewIdentities()">
                            <xf:macro template="custom_fields_macros" name="custom_fields_view"
                                arg-type="users"
                                arg-group="contact"
                                arg-set="{$user.Profile.custom_fields}"
                                arg-additionalFilters="{{ ['message'] }}"
                                arg-valueClass="pairs pairs--justified" />
                        </xf:if>
                    </xf:if>

Replace:
HTML:
$0

<xf:macro template="ah_gamerprofiles_macros" name="ah_gamerprofiles_message" />

The problem is, I can't get anything to appear. I'm positive the problem is with the macros because I put in this code directly it works fine.
Code:
<xf:set var="$ahGPStatus" value="{{ property('ahGPStatus') }}" />
    <xf:if contentcheck="true">
        <div class="ah-gp-icons-container">
        <xf:contentcheck>

            <xf:comment>PlayStation</xf:comment>
            <xf:if is="{$user.Profile.custom_fields.ah_playstation} AND $ahGPStatus.ah_playstation">
                <a href="https://gamercards.exophase.com/psn/user/{$user.Profile.custom_fields.ah_playstation}" class="ah-gp-trigger" target="_blank">
                    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 26 26" version="1.1" class="ah-gp-svg ah-gp-svg--playstation">
                        <g id="surface1">                              
                            <path style=" " d="M 10 3.5 L 10 21.84375 L 13.96875 23.0625 L 13.96875 7.75 C 13.96875 7.34375 14.019531 7.046875 14.1875 6.875 C 14.355469 6.640625 14.511719 6.617188 14.75 6.71875 C 15.324219 6.886719 15.59375 7.40625 15.59375 8.25 L 15.59375 14.40625 C 16.878906 15.015625 18.03125 15.078125 18.875 14.4375 C 19.753906 13.828125 20.21875 12.746094 20.21875 11.125 C 20.21875 9.433594 19.902344 8.128906 19.15625 7.28125 C 18.480469 6.371094 17.289063 5.640625 15.53125 5.03125 C 13.335938 4.320313 11.488281 3.8125 10 3.5 Z M 8.78125 14.59375 L 8 14.84375 L 3.09375 16.59375 L 2.25 16.9375 C 0.964844 17.476563 0.277344 18.054688 0.3125 18.5625 C 0.378906 19.304688 1.226563 19.84375 2.75 20.25 C 4.726563 20.78125 6.730469 20.902344 8.78125 20.59375 L 8.78125 18.5 L 8 18.78125 L 7.125 19.125 L 5.71875 19.40625 L 4.375 19.25 C 4.105469 19.078125 4.015625 18.886719 4.1875 18.71875 C 4.355469 18.617188 4.605469 18.476563 4.875 18.375 L 5.78125 18.0625 L 8.78125 17 Z M 20.15625 15.5625 C 19.789063 15.546875 19.417969 15.578125 19.0625 15.59375 C 17.75 15.621094 16.402344 15.835938 15 16.28125 L 15 18.75 L 17.78125 17.78125 L 19.21875 17.28125 C 19.21875 17.28125 19.761719 17.136719 20.15625 17.03125 C 20.761719 16.871094 21.40625 17.09375 21.40625 17.09375 C 21.777344 17.125 21.964844 17.265625 22.03125 17.4375 C 22.097656 17.640625 21.851563 17.796875 21.34375 17.96875 L 20.09375 18.46875 L 15 20.28125 L 15 22.6875 L 17.375 21.84375 L 23.09375 19.8125 L 23.78125 19.5 C 25.136719 18.992188 25.753906 18.457031 25.6875 17.78125 C 25.652344 17.136719 24.882813 16.628906 23.53125 16.1875 C 22.390625 15.804688 21.253906 15.605469 20.15625 15.5625 Z "/>
                        </g>
                    </svg>

                    <img src="//card.exophase.com/psn/{$user.Profile.custom_fields.ah_playstation}.png" class="ah-gp-profile" />
                </a>
            </xf:if>
           
        </xf:contentcheck>
        </div>
    </xf:if>

Does anyone have any suggestions? Thank you.
 
I think the replace should be
HTML:
$0

<xf:macro template="ah_gamerprofiles_macros" name="ah_gamerprofiles_message" arg-user="{$user}" />

Yes, that was part of it! I also had to add arg-user="!" to <xf:macro name="ah_gamerprofiles_message">

Thanks for the assistance!
 
  • Like
Reactions: DL6
Back
Top Bottom