XF 1.2 User Profile field conditionals in CSS?

JMEWLS

Active member
#1
Okay guys, basically on my previous vBulletin forum I implemented two things..

1. Team rep.
2. User background

What I did was use profile fields for this, for the user background I just made them post the link. Then in the header I'd include..

<style>
background-image: <if userprofile field>[user profile field]</else> default image</if>
</style>

For the team rep I'd like to get their favorite teams background into the postbit.

http://nbadimensions.net/forums/threads/2013-free-agency-discussion-thread.136251/

So where the username is there, I'd like to get their favorite teams background in that grey box. So I'm thinking I can add an if conditional to the message.user.info.css template or something? Just not sure how to go about it..

Cheers guys.
 

JMEWLS

Active member
#4
Been adding this to the header with no luck...

<xen:if is="{$user.customFields.website_background}">
<style>
body
{
background-image: url('{$user.customFields.website_background}') !important;
background-repeat:repeat !important;
background-attachment: fixed !important;
}
</style>
</xen:if>
 

Jeremy

Well-known member
#8
It depends on the context. Visitor usually implies the visitor to the page and user usually implies a static user. Templates only have access to variables provided to them, meaning some variables aren't accessible everywhere.
 

JMEWLS

Active member
#9
Fair enough, I'm also kind of confused with template conditionals for usergroups. I'm trying to color a background a different color if they're part of a certain usergroup.

<div class="userText" style="background-color: <xen:if is="{xen:helper ismemberof, $visitor, 38}">#C90; <xen:else />#EDEDED;</xen:if> text-shadow:1px 1px #FFF; text-align:center; border-bottom: 1px solid #d8d8d8; width:112px; padding:5px;">

It just seems to color everyone the first color though. If my conditional right? It's in the message_user_info template.

@King Kovifor
 
Top