XF 1.2 User Profile field conditionals in CSS?

JMEWLS

Active member
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.
 
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>
 
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.
 
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
 
Back
Top Bottom