• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Custom User Fields in Quick Preview

Matt C.

New Member
AMS Premium
CAS Premium
EMS Early Adopter
IMS Premium
LD Premium
RMS Premium
SC Premium
UBS Premium
I'm trying to put custom user fields in the quick preview template, but I've run into some problems.

This is what I get (this is from the quick preview url)
Screenshot.png

Here is the code inside "nflj_showcase_item_quick_preview"
Code:
<div class="previewTooltip">
    <xen:if is="{$item.cover_image}">
        <a class="avatar NoOverlay" href="{xen:link showcase, $item}">
            <img width="48" height="48" border="0" src="{$item.cover_image.thumbnailUrl}" />
        </a>                       
    <xen:elseif is="{$category.category_image}" />
        <a class="avatar NoOverlay" href="{xen:link showcase, $item}">
            <img width="48" height="48" border="0" alt="{$category.category_name}" src="@imagePath/nflj/showcase/category_images/{$category.category_image}">
        </a>
    <xen:else />   
        <xen:avatar user="$itemUser" size="s" />
    </xen:if>
    
    <div class="text">
        <xen:if is="{$item.customFields.weaponDmg}">
                <dl class="customShowcaseFieldweaponDmg">
                       <dt>{xen:helper showcaseFieldTitle, 'weaponDmg'}:</dt>
                        <dd>{xen:helper showcaseFieldValue, $item, 'weaponDmg', {$item.customFields.weaponDmg}}</dd>
                </dl>
        </xen:if>
                
        <xen:if is="{$item.customFields.weaponAcc}">
                <dl class="customShowcaseFieldweaponAcc">
                       <dt>{xen:helper showcaseFieldTitle, 'weaponAcc'}:</dt>
                        <dd>{xen:helper showcaseFieldValue, $item, 'weaponAcc', {$item.customFields.weaponAcc}}</dd>
                </dl>
        </xen:if>
                
        <xen:if is="{$item.customFields.weaponRng}">
                <dl class="customShowcaseFieldweaponRng">
                       <dt>{xen:helper showcaseFieldTitle, 'weaponRng'}:</dt>
                        <dd>{xen:helper showcaseFieldValue, $item, 'weaponRng', {$item.customFields.weaponRng}}</dd>
                </dl>
        </xen:if>
                
        <xen:if is="{$item.customFields.weaponRoF}">
                <dl class="customShowcaseFieldweaponRoF">
                       <dt>{xen:helper showcaseFieldTitle, 'weaponRoF'}:</dt>
                        <dd>{xen:helper showcaseFieldValue, $item, 'weaponRoF', {$item.customFields.weaponRoF}}</dd>
                </dl>
        </xen:if>
                
        <xen:if is="{$item.customFields.weaponAmm}">
                   <dl class="customShowcaseFieldweaponAmm">
                      <dt>{xen:helper showcaseFieldTitle, 'weaponAmm'}:</dt>
                       <dd>{xen:helper showcaseFieldValue, $item, 'weaponAmm', {$item.customFields.weaponAmm}}</dd>
                   </dl>
        </xen:if>
    </div>
</div>

Any help would be appreciated!
 
The VIEW file (/library/NFLJ/Showcase/ViewPublic/Item/QuickPreview.php) associated with the action (NFLJ_Showcase_ControllerPublic_Item::QuickPreview) is NOT registered (which is required in order for custom field output).

File: /library/NFLJ/Showcase/ViewPublic/Item/QuickPreview.php
PHP:
<?php

class NFLJ_Showcase_ViewPublic_Item_QuickPreview extends XenForo_ViewPublic_Base
{
    public function renderHtml()
    {
        $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
        $parser = new XenForo_BbCode_Parser($formatter);
        
        $this->_params['item']['message'] = $parser->render($this->_params['item']['message']);
    }
}


Add (as shown below): XenForo_Application::set('view', $this);

PHP:
<?php

class NFLJ_Showcase_ViewPublic_Item_QuickPreview extends XenForo_ViewPublic_Base
{
    public function renderHtml()
    {
        XenForo_Application::set('view', $this);
        
        $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
        $parser = new XenForo_BbCode_Parser($formatter);
        
        $this->_params['item']['message'] = $parser->render($this->_params['item']['message']);
    }
}
 
The VIEW file (/library/NFLJ/Showcase/ViewPublic/Item/QuickPreview.php) associated with the action (NFLJ_Showcase_ControllerPublic_Item::QuickPreview) is NOT registered (which is required in order for custom field output).

File: /library/NFLJ/Showcase/ViewPublic/Item/QuickPreview.php
PHP:
<?php

class NFLJ_Showcase_ViewPublic_Item_QuickPreview extends XenForo_ViewPublic_Base
{
    public function renderHtml()
    {
        $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
        $parser = new XenForo_BbCode_Parser($formatter);
       
        $this->_params['item']['message'] = $parser->render($this->_params['item']['message']);
    }
}


Add (as shown below): XenForo_Application::set('view', $this);

PHP:
<?php

class NFLJ_Showcase_ViewPublic_Item_QuickPreview extends XenForo_ViewPublic_Base
{
    public function renderHtml()
    {
        XenForo_Application::set('view', $this);
       
        $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
        $parser = new XenForo_BbCode_Parser($formatter);
       
        $this->_params['item']['message'] = $parser->render($this->_params['item']['message']);
    }
}

Hey thanks! Maybe you could add this in your next release! :)
 
Back
Top