Getting Custom Userfields to show in Members area:

CritiKiL

Active member
I would like for this code to show under a members name 'if the custom userfield is filled out:

Code:
<table><tr><td>
<xen:if is="{$user.customFields.psnlive}"><a href="http://us.playstation.com/playstation/psn/visit/profiles/{$user.customFields.psnlive}" target="_new"><img src="/community/game_images/psnlive.png" width="25px" height="25px" /></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.xboxlive}"><a href="http://live.xbox.com/en-US/Profile?Gamertag={$user.customFields.xboxlive}" target="_new"/><img src="/community/game_images/xboxlive.png" width="25px" height="25px"></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.pclive}"><a href="http://steamcommunity.com/id/{$user.customFields.pclive}" target="_new"/><img src="/community/game_images/pclive.png" width="25px" height="25px"></a>
</xen:if>
</td></tr></table>
It works under a members name in the message_user_info template but it won't work in the Registered Members / XenStaff areas under a members name. Can someone show me how to fix this code so that it works?

It it setup so that if one of 3 custom userfields are filled, an icon will display to show info has been filled out in that field. Here is how it looks in the message_user_info area (the PSN, XBL and PC icon circles):

membersconsoles1.webp

And this is where I want it to also show (under the members name):

membersconsoles.webp
 
Review the instructions again. For XenStaff there are two red blocks. I suspect you missed the first one.
I seem to be missing any 'second red code' in that block?:
Reminded of this:

http://xenforo.com/community/thread...message_user_info-template.20792/#post-314978

This is for the member list and not XenStaff, but in looking at the code I think the same problem applies.

Untested but...

library/XenStaff/ControllerPublic/Index.php

Add the red code:

Rich (BB code):
<?php
 
class XenStaff_ControllerPublic_Index extends XenForo_ControllerPublic_Abstract
{
 
public function actionIndex()
{
 
$options = XenForo_Application::get('options');
 
if (!$options->displaystaffActive)
{
return $this->responseError(new XenForo_Phrase('access_url_staff_off'));
}
 
 
$staffGroupsModel = $this->getModelFromCache('XenStaff_Model_StaffGroups');
$staffGroupsUserIdsModel = $this->getModelFromCache('XenStaff_Model_StaffGroupsUserIds');
$staffUserInfoModel = $this->getModelFromCache('XenForo_Model_User');
$staffGroupsUniqueIdsModel = $this->getModelFromCache('XenStaff_Model_StaffGroupsUniqueIds');
 
$staffGroups = $staffGroupsModel->getSelectedUserGroups();
$staffGroupsUserIds = $staffGroupsUserIdsModel->getListofUsersPerStaffGroup();
$staffIds = $staffGroupsUniqueIdsModel->getListofUniqueIds($staffGroupsUserIds);
$staffUserInfo = $staffUserInfoModel->getUsersByIds($staffIds, $staffOptions = array('join' => XenForo_Model_User::FETCH_USER_FULL));
 
$staffUserInfo = $staffUserInfoModel->prepareUserCards($staffUserInfo);
 
$visitor = XenForo_Visitor::getInstance();
 
 
if ((!$options->displaystafftoAll) AND !(in_array($visitor['user_id'], $staffIds)))
{
return $this->responseError(new XenForo_Phrase('access_url_staff_only'));
}
 
 
$onlineUsers = $this->getModelFromCache('XenForo_Model_Session')->getSessionActivityQuickList(
$visitor->toArray(),
array('cutOff' => array('>', $this->getModelFromCache('XenForo_Model_Session')->getOnlineStatusTimeout())),
($visitor['user_id'] ? $visitor->toArray() : null)
);
 
        $staffOnline = array();
 
if (!empty($onlineUsers))
                {
        foreach ($onlineUsers['records'] AS $staffId)
        {
 
                if (in_array($staffId['user_id'], $staffIds))
                                {
                                      $staffOnline[] = $staffId;
                                }
 
        }
 
}
 
$viewParams = array(
'staffgroups' => $staffGroups,
'staffgroupsuserids' => $staffGroupsUserIds,
'staffuserinfo' => $staffUserInfo,
'staffonline' => $staffOnline
);
 
return $this->responseView('XenStaff_ViewPublic_Index', 'XenStaff_index', $viewParams);
 
}
 
}

That should allow you to use this code inside of the member_list_item template:

Rich (BB code):
{$user.customFields.field_id}

Note that editing this template will affect both the member list and the XenStaff page since they both use the same template.
 
Sig where?
Under the forum signatures:

xenforosig.webp

Using same code, but it doesn't show up when I place it under the signatures. I would like them to show there, just for the mobile template because that template has no sidebars:
Code:
<table><tr><td>
&nbsp;&nbsp;<xen:if is="{$user.customFields.psnlive}"><a href="http://us.playstation.com/playstation/psn/visit/profiles/{$user.customFields.psnlive}" target="_new"><img src="/community/game_images/psnlive.png" width="25px" height="25px" /></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.xboxlive}"><a href="http://live.xbox.com/en-US/Profile?Gamertag={$user.customFields.xboxlive}" target="_new"/><img src="/community/game_images/xboxlive.png" width="25px" height="25px"></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.pclive}"><a href="http://steamcommunity.com/id/{$user.customFields.pclive}" target="_new"/><img src="/community/game_images/pclive.png" width="25px" height="25px"></a>
</xen:if>
</td></tr></table>
 
I wanted a specific location since sigs show in more than one area. But I believe the custom fields are prepared in all areas where sigs are used, so {$user.customFields.field_id} should work.
 
I wanted a specific location since sigs show in more than one area. But I believe the custom fields are prepared in all areas where sigs are used, so {$user.customFields.field_id} should work.
For some reason this code does not work under the sigs (in the Posts and Convo's areas):
Code:
<table><tr><td>
&nbsp;&nbsp;<xen:if is="{$user.customFields.psnlive}"><a href="http://us.playstation.com/playstation/psn/visit/profiles/{$user.customFields.psnlive}" target="_new"><img src="/community/game_images/psnlive.png" width="25px" height="25px" /></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.xboxlive}"><a href="http://live.xbox.com/en-US/Profile?Gamertag={$user.customFields.xboxlive}" target="_new"/><img src="/community/game_images/xboxlive.png" width="25px" height="25px"></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.pclive}"><a href="http://steamcommunity.com/id/{$user.customFields.pclive}" target="_new"/><img src="/community/game_images/pclive.png" width="25px" height="25px"></a>
</xen:if>
</td></tr></table>
The code now works in the places you have helped me with in this post, but that same table doesn't work under the sigs for some reason. Something is missing, that would make the table in this code show.
 
Which template? For example, in the message template you would use {$message.customFields.field_id}
Ok now I'm confused. in the message template I want this code to show the images 'if' the custom user field condition is satisfied, for each user:
Code:
<table><tr><td>
&nbsp;&nbsp;<xen:if is="{$user.customFields.psnlive}"><a href="http://us.playstation.com/playstation/psn/visit/profiles/{$user.customFields.psnlive}" target="_new"><img src="/community/game_images/psnlive.png" width="25px" height="25px" /></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.xboxlive}"><a href="http://live.xbox.com/en-US/Profile?Gamertag={$user.customFields.xboxlive}" target="_new"/><img src="/community/game_images/xboxlive.png" width="25px" height="25px"></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.pclive}"><a href="http://steamcommunity.com/id/{$user.customFields.pclive}" target="_new"/><img src="/community/game_images/pclive.png" width="25px" height="25px"></a>
</xen:if>
</td></tr></table>
But in cases where the images should be showing (xen:if is=true) they DO show, but just not under the signatures in the message template. The code above works everywhere else I have the it posted [ex: shows in the message_user_info area, and NOW shows in the Xenstaff area (thanks to your earlier edit suggestions in this thread)]. It just doesn't show in the message area where I'd like for it to show, under the signature ;-)
 
My current message template w/custom usersfield code:
Code:
<xen:require css="message.css" />
<xen:require css="bb_code.css" />
 
 
 
 
 
 
 
 
 
<li id="{$messageId}" class="message {xen:if $message.isDeleted, 'deleted'} {xen:if '{$message.is_admin} OR {$message.is_moderator}', 'staff'} {xen:if $message.isIgnored, ignored}" data-author="{$message.username}">
 
<xen:include template="message_user_info">
<xen:map from="$message" to="$user" />
</xen:include>
 
<div class="messageInfo primaryContent">
<xen:if is="{$message.isNew}"><strong class="newIndicator"><span></span>{xen:phrase new}</strong></xen:if>
 
<xen:if hascontent="true">
<ul class="messageNotices">
<xen:contentcheck>
<xen:hook name="message_notices" params="{xen:array 'message={$message}'}">
<xen:if is="{$message.warning_message}">
<li class="warningNotice"><span class="icon Tooltip" title="{xen:phrase warning}" data-tipclass="iconTip flipped"></span>{$message.warning_message}</li>
</xen:if>
<xen:if is="{$message.isDeleted}">
<li class="deletedNotice"><span class="icon Tooltip" title="{xen:phrase deleted}" data-tipclass="iconTip flipped"></span>{xen:phrase this_message_has_been_removed_from_public_view}</li>
<xen:elseif is="{$message.isModerated}" />
<li class="moderatedNotice"><span class="icon Tooltip" title="{xen:phrase awaiting_moderation}" data-tipclass="iconTip flipped"></span>{xen:phrase this_message_is_awaiting_moderator_approval_and_is_invisible_to_normal}</li>
</xen:if>
<xen:if is="{$message.isIgnored}">
<li>{xen:phrase you_are_ignoring_content_by_this_member} <a href="javascript:" class="jsOnly DisplayIgnoredContent">{xen:phrase show_ignored_content}</a></li>
</xen:if>
</xen:hook>
</xen:contentcheck>
</ul>
</xen:if>
 
<xen:hook name="message_content" params="{xen:array 'message={$message}'}">
<div class="messageContent">
<article>
<blockquote class="messageText ugc baseHtml{xen:if $message.isIgnored, ' ignored'}">
<xen:include template="ad_message_body" />
{xen:raw $message.messageHtml}
</blockquote>
</article>
 
{xen:raw $messageContentAfterTemplate}
</div>
</xen:hook>
 
 
 
 
 
 
 
 
<xen:if is="{$visitor.content_show_signature} && {$message.signature}">
<div class="baseHtml signature ugc{xen:if $message.isIgnored, ' ignored'}"><aside>{xen:raw $message.signatureHtml}</aside></div>
 
 
<center><br>
 
<xen:include template="StatsBar_manual">
<xen:map from="$message" to="$user" />
</xen:include>
 
 
 
 
<xen:include template="bdmedal_message_medals">
            <xen:map from="$message" to="$user" />
        </xen:include>
 
 
 
 
 
<table><tr><td>
<xen:if is="{$user.customFields.psnlive}"><a href="http://us.playstation.com/playstation/psn/visit/profiles/{$user.customFields.psnlive}" target="_new"><img src="/community/game_images/psnlive.png" width="25px" height="25px" /></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.xboxlive}"><a href="http://live.xbox.com/en-US/Profile?Gamertag={$user.customFields.xboxlive}" target="_new"/><img src="/community/game_images/xboxlive.png" width="25px" height="25px"></a>
</xen:if></td><td>
<xen:if is="{$user.customFields.pclive}"><a href="http://steamcommunity.com/id/{$user.customFields.pclive}" target="_new"/><img src="/community/game_images/pclive.png" width="25px" height="25px"></a>
</xen:if>
</td></tr></table>
 
 
 
 
 
 
</center>
 
 
 
 
 
 
 
</xen:if>
 
 
 
 
 
 
 
 
{xen:raw $messageAfterTemplate}
 
<div id="likes-{$messageId}"><xen:if is="{$message.likes}"><xen:include template="likes_summary" /></xen:if></div>
</div>
 
 
 
 
 
<xen:include template="ad_message_below" />
 
</li>
 
Back
Top Bottom