Resource icon

XF 2 Tip Postbit Background Custom Fields

Verss

Custom Developer
Collaborate
Registered
Joined
Apr 21, 2019
Messages
133
Points
53

Reputation:

Verss submitted a new resource:

Postbit Background Custom Fields - template modification

1. Make a custom user field

2. Title Postbit Cover or Anything you want

3. Field ID can be anything i suggest no space on it

4. Description : JPG, PNG, GIF (Link of the Image)

5. Display Location : Personal Details

6. Field Type: Single Line text Box

7. General Option: User editable, Moderator Editable

8. go to templates >> search message_macros >> paste this after xf:macro

Code:
<div class="postbit_background" style="background-image...
Read more about this resource...
 

popwoo

SVIP Member
S.V.I.P Member
Registered
Joined
Jul 28, 2020
Messages
99
Points
33

Reputation:

Anyone know if this still is working? I attempted it but looks like the background goes above the users avatar. Im not sure if it needs updating or if its a little outdated.
 

Kei

Member
Registered
Joined
Aug 9, 2020
Messages
18
Points
3

Reputation:

Its work fine, you just need extra code to make it suits to ur theme
 
View previous replies…

Kei

Member
Registered
Joined
Aug 9, 2020
Messages
18
Points
3

Reputation:

@popwoo if the height and width already set by css shouldnt be a problem, the problem is loading the image
 

popwoo

SVIP Member
S.V.I.P Member
Registered
Joined
Jul 28, 2020
Messages
99
Points
33

Reputation:

@Kei yeah, this question is more about loading times than height and width as its set perfectly now with ur suggestion and a few other background properties. :)
 

Pr0fesseur

Collaborate
Collaborate
Registered
Joined
Nov 20, 2019
Messages
199
Points
63

Reputation:

I suggest you test it with the default xenforo style first and determine if its your style that is interfering or some setting that you need to play with.. this should work as intended
 

valid

SVIP Member
S.V.I.P Member
Registered
Joined
Apr 3, 2020
Messages
56
Points
18

Reputation:

The code from the original poster is wrong. That's why I couldn't get the background image shown as expected.

<div class="postbit_background" style="background-image: url({$user.Profile.custom_fields.YourFieldID});"></div>

should be changed to:

<div class="postbit_background" style="background-image: url({$xf.visitor.Profile.custom_fields.YourFieldID});"></div>
 

Kei

Member
Registered
Joined
Aug 9, 2020
Messages
18
Points
3

Reputation:

You are wrong buddy, xf.visitor determines your value only as a output
 

valid

SVIP Member
S.V.I.P Member
Registered
Joined
Apr 3, 2020
Messages
56
Points
18

Reputation:

I just used trial and error and found it worked.

The original $user.Profile can't show the background image.
 

Kei

Member
Registered
Joined
Aug 9, 2020
Messages
18
Points
3

Reputation:

lmao what, the purpose write it as $user is for each users who wants to use it not with $xf.visitor
theres something wrong with urs
 

Kei

Member
Registered
Joined
Aug 9, 2020
Messages
18
Points
3

Reputation:

xf.visitor is not the right code, it determines your value only
 
Top