XF 2.0 Custom fields in message user info

Sunka

Well-known member
On xf1 when user choose hoby in custom user field it shows on message user info (under avatar).
I managed to show little icon against text. First part was added to message_user_info.php and second was in extra.css

Code:
<xen:if is="{$user.customFields.na_forumu_sam_poradi} == 'vrtlarstva'">
<div align="center"><i class="hobi hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i></div>
<xen:elseif is="{$user.customFields.na_forumu_sam_poradi} == 'ribolova'" />
<div align="center" title="Hobi: Ribolov"><i class="hobi hobi-ribolov"></i></div>
<xen:elseif is="{$user.customFields.na_forumu_sam_poradi} == 'vrtlarstva_i_ribolova'" />
<div align="center"><i class="hobi hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i>&nbsp; &nbsp;<i class="hobi hobi-ribolov" title="Hobi: Ribolov"></i></div>
</xen:if>

Code:
.hobi {
    background-image: url('moje_graphic/hobi/hobi_sprites.png');
    background-repeat: no-repeat;
    display: inline-block;
}

.hobi-ribolov {
    width: 32px;
    height: 32px;
    background-position: -5px -5px;
}

.hobi-vrtlarstvo {
    width: 32px;
    height: 32px;
    background-position: -47px -5px;
}


I tried xf2 equivalent in message_macros template (also added second part into extra.less), but nothing shows.
Somewhere is error in code.
Code:
<xf:if is="{$xf.visitor.custom_fields.na_forumu_sam_poradi} == 'vrtlarstva'">
<div align="center"><i class="hobi hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i></div>
<xf:elseif is="{$xf.visitor.custom_fields.na_forumu_sam_poradi} == 'ribolova'" />
<div align="center" title="Hobi: Ribolov"><i class="hobi hobi-ribolov"></i></div>
<xf:elseif is="{$xf.visitor.custom_fields.na_forumu_sam_poradi} == 'vrtlarstva_i_ribolova'" />
<div align="center"><i class="hobi hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i>&nbsp; &nbsp;<i class="hobi hobi-ribolov" title="Hobi: Ribolov"></i></div>
</xf:if>

xen:if changed to xf:if
$user.customFields changed to $xf.visitor.custom_fields

I also tried changing <i class="hobi hobi-ribolov"> to <i class="hobi.hobi-ribolov">

Could anyone help with this?
 
Change $xf.visitor.custom_fields to $user.Profile.custom_fields.
Tried, not working

Code:
<xf:if is="{$user.Profile.custom_fields.na_forumu_sam_poradi} == 'vrtlarstva'">
<div align="center"><i class="hobi.hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i></div>
<xf:elseif is="{$user.Profile.custom_fields.na_forumu_sam_poradi} == 'ribolova'" />
<div align="center" title="Hobi: Ribolov"><i class="hobi.hobi-ribolov"></i></div>
<xf:elseif is="{$user.Profile.custom_fields.na_forumu_sam_poradi} == 'vrtlarstva_i_ribolova'" />
<div align="center"><i class="hobi.hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i>&nbsp; &nbsp;<i class="hobi.hobi-ribolov" title="Hobi: Ribolov"></i></div>
</xf:if>
 
Change the classes again
hobi.hobi-vrtlarstvo to hobi hobi-vrtlarstvo and hobi.hobi-ribolov to hobi hobi-ribolov
Code:
<xf:if is="{$user.Profile.custom_fields.na_forumu_sam_poradi} == 'vrtlarstva'">
<div align="center"><i class="hobi hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i></div>
<xf:elseif is="{$user.Profile.custom_fields.na_forumu_sam_poradi} == 'ribolova'" />
<div align="center" title="Hobi: Ribolov"><i class="hobi hobi-ribolov"></i></div>
<xf:elseif is="{$user.Profile.custom_fields.na_forumu_sam_poradi} == 'vrtlarstva_i_ribolova'" />
<div align="center"><i class="hobi hobi-vrtlarstvo" title="Hobi: Vrtlarstvo"></i>&nbsp; &nbsp;<i class="hobi hobi-ribolov" title="Hobi: Ribolov"></i></div>
</xf:if>
 
Oh, now it is working.
On last two tries I added to member_macros o_O

@DL6

Could you help me to find more things to add in there?

equivalent for Last time seen (online)

Code:
<dl class="pairsJustified">
<dt>Last seen:</dt>
<dd>{xen:datetime $user.last_activity}</dd>
</dl>

and warning points (only see if member is in Staff

Code:
<xen:if is="{$canViewWarnings}">           
<xen:if is="{xen:number $user.warning_points} != 0">
<dl class="pairsJustified">
<dt>{xen:phrase warning_points}:</dt>
<dd><a href="{xen:link members, $user}#warnings" class="concealed"><font color="#9b0000">{xen:number $user.warning_points}</font></a></dd>
</dl>
</xen:if>
</xen:if>
 
equivalent for Last time seen (online)
Code:
<xf:if is="$user.visible OR $xf.visitor.canBypassUserPrivacy()">
    <dl class="pairs pairs--justified">
        <dt>{{ phrase('last_seen') }}</dt>
        <dd><xf:date time="{$user.last_activity}" /></dd>
    </dl>
</xf:if>
and warning points (only see if member is in Staff
Code:
<xf:if is="$xf.visitor.canViewWarnings() && $user.warning_count">
    <dl class="pairs pairs--justified">
        <dt>{{ phrase('warnings') }}</dt>
        <dd>
            <a href="{{ link('members', $user) }}#warnings" class="fauxBlockLink-linkRow u-concealed">
                {$user.warning_points|number}
            </a>
        </dd>
    </dl>
</xf:if>
 
Thank you very much.
You are kind person @DL6

Could you help me for title and background styling for closed threads?
For soft deleted threads I have this

CSS:
.structItem.is-deleted
{
    background-color: #b1b1b1;
}

.structItem.is-deleted .structItem-title
{
    text-decoration: none;
}

But for closed threads I can not find nothing


If you have time, can you create 2 small addons?
I can pay you (paypal) for that... I do not know, 10 dollars for both?
You can deliver after to people here for free.
I need nested tags and automatic space before and after smilie in posts
 
Top Bottom