XF 2.0 Error explanation? Accessed unknown getter 'customFields' on XF:User

Tealk

Well-known member
Hello,
can someone tell me where this mistake came from?

I have add this part to the member tooltip:
1514067021714.webp

Code:
InvalidArgumentException: Accessed unknown getter 'customFields' on XF:User[596] src/XF/Mvc/Entity/Entity.php:179
Generated by: ZarJohn Dec 22, 2017 at 11:11 PM
Stack trace
#0 src/XF/Mvc/Entity/Entity.php(97): XF\Mvc\Entity\Entity->get('customFields')
#1 internal_data/code_cache/templates/l3/s11/public/member_macros.php(344): XF\Mvc\Entity\Entity->offsetGet('customFields')
#2 src/XF/Template/Templater.php(643): XF\Template\Templater->{closure}(Object(KL\UserImprovements\Template\Templater), Array, Array)
#3 internal_data/code_cache/templates/l3/s11/public/member_tooltip.php(139): XF\Template\Templater->callMacro('member_macros', 'member_stat_gam...', Array, Array)
#4 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(KL\UserImprovements\Template\Templater), Array)
#5 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('member_tooltip', Array)
#6 src/XF/Mvc/Renderer/Json.php(81): XF\Template\Template->render()
#7 src/XF/Mvc/Renderer/Json.php(65): XF\Mvc\Renderer\Json->renderHtmlFallback('XF:Member\\Toolt...', 'public:member_t...', Array)
#8 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Json->renderView('XF:Member\\Toolt...', 'public:member_t...', Array)
#9 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#10 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#11 src/XF/App.php(1880): XF\Mvc\Dispatcher->run()
#12 src/XF.php(328): XF\App->run()
#13 index.php(13): XF::runApp('XF\\Pub\\App')
#14 {main}
Request state
array(4) {
  ["url"] => string(197) "/members/der-xxx.xxx/?tooltip=true&_xfRequestUri=%2Fconversations%2xxx%2F&_xfWithData=1&_xfToken=1513980709%2C40855f671c0418d0451d73bc9e57365d&_xfResponseType=json"
  ["referrer"] => string(72) "https://anzahcraft.de/conversations/xxx/"
  ["_GET"] => array(5) {
    ["tooltip"] => string(4) "true"
    ["_xfRequestUri"] => string(51) "/conversations/xxx/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(43) "1513980709,40855f671c0418d0451d73bc9e57365d"
    ["_xfResponseType"] => string(4) "json"
  }
  ["_POST"] => array(0) {
  }
}

//Edit
my code generates this error, can someone tell me why?

HTML:
<xf:if contentcheck="true">
            <hr class="memberTooltip-separator" />

            <div class="memberTooltip-info">
            <xf:contentcheck>
                <xf:macro template="member_macros" name="member_stat_gameaccounds"
                    arg-user="{$user}"
                    arg-context="tooltip" />
            </xf:contentcheck>
            </div>
        </xf:if>

HTML:
<xf:macro name="member_stat_gameaccounds" arg-user="!" arg-context="!">
    <xf:if is="{$xf.visitor.is_staff}">
        <dl class="gameaccounds">
            <!-- slot: ARKChar -->
            <div class="newrow">
                <dt>{{ $user.Profile.custom_fields.getDefinition('rp_ark_name').title }}:</dt>
                <xf:if is="{$user.Profile.custom_fields.rp_ark_name}">
                    <dd>{$user.Profile.custom_fields.rp_ark_name}</dd>
                    <xf:else />
                    <dd>n/a</dd>
                </xf:if>
            </div>
            <!-- slot: SteamIDs -->
            <div class="newrow">
                <dt>{{ $user.Profile.custom_fields.getDefinition('steamID64').title }}:</dt>
                <xf:if is="{$user.Profile.custom_fields.steamID64}">
                    <dd><a href="https://steamid.io/lookup/{$user.Profile.custom_fields.steamID64}" target="_blank">{$user.Profile.custom_fields.steamID64}</a></dd>
                    <xf:else />
                    <dd>n/a</dd>
                </xf:if>
            </div>
            <!-- slot: Altis -->
            <div class="newrow">
                <dt>{{ $user.Profile.custom_fields.getDefinition('rp_arma_name').title }}:</dt>
                <xf:if is="{$user.customFields.rp_arma_name}">
                    <dd>{$user.customFields.rp_arma_name}</dd>
                    <xf:else />
                    <dd>n/a</dd>
                </xf:if>
            </div>
            <!-- slot: Arma3 GuID -->
            <div class="newrow">
                <dt>{{ $user.Profile.custom_fields.getDefinition('arma_guid').title }}:</dt>
                <xf:if is="{$user.customFields.arma_guid}">
                    <dd>{$user.customFields.arma_guid}</dd>
                    <xf:else />
                    <dd>n/a</dd>
                </xf:if>
            </div>
        </dl>
    </xf:if>
</xf:macro>
 
Last edited:
This pattern occurs a couple times but:
Code:
<xf:if is="{$user.customFields.rp_arma_name}">
The data you want is part of the UserProfile not the User itself, and thus is accessible via {$user.Profile} -- see the working examples higher in the template.

The error message is generally telling you that you're trying to access some data that can't exist because it's not a known column/field on that object.
 
Back
Top Bottom