• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Custom user fields

#1
Hi! I'm trying to add background image behind avatar holder in message user info like this:

^ Sorry for Finnish language in image
HTML:
.messageUserBlock div.avatarHolder {
    padding: 25px !important;
    background-image: url("/styles/mystyle/avatarholderbackgrounds/default.png");
    background-size: cover;
}
HTML:
<div class="avatarHolder">
            <span class="helper"></span>
            <xen:avatar user="$user" size="m" img="true" />
            <xen:if is="{$user.isOnline}"><span class="Tooltip onlineMarker" title="{xen:phrase online_now}" data-offsetX="-22" data-offsetY="-8"></span></xen:if>
            <!-- slot: message_user_info_avatar -->
        </div>
So, my question is:
How I can add different avatarHolder background for everyone? Users can select their background with custom user fields (radio buttons).

Sorry poor English language skills. I hope you realize what I mean :D
 

Mike

XenForo developer
Staff member
#2
You'd probably want to make the "IDs" of the radio field represent class names (or class suffixes). Then you'd add an extra class name to the avatarHolder div based on that value. Your custom CSS would just override the image based on that (.messageUserBlock div.avatarHolder.customFieldClassName).