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

Well-known member
Registered
Joined
Jul 28, 2020
Messages
108
Points
43

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.
 

TurtleDoveWubby

Member
Registered
Joined
Jul 17, 2020
Messages
18
Points
3

Reputation:

It works, however like @Pr0fesseur said, custom styles override the custom user field settings and postbit CSS. It still works, but it needed a few tweaks and some extra code.

Default works fine though.
 

Kei

Well-known member
Registered
Joined
Aug 9, 2020
Messages
45
Points
18

Reputation:

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

Kei

Well-known member
Registered
Joined
Aug 9, 2020
Messages
45
Points
18

Reputation:

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

popwoo

Well-known member
Registered
Joined
Jul 28, 2020
Messages
108
Points
43

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

SVIP Member
S.V.I.P Member
Collaborate
Registered
Joined
Nov 20, 2019
Messages
262
Points
73

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
 

michi

New member
Registered
Joined
Sep 23, 2020
Messages
1
Points
3

Reputation:

Is there a way to auto resize the image linked?
 

Kei

Well-known member
Registered
Joined
Aug 9, 2020
Messages
45
Points
18

Reputation:

Set the width and height as u want it to be
 

valid

Well-known member
Registered
Joined
Apr 3, 2020
Messages
64
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

Well-known member
Registered
Joined
Aug 9, 2020
Messages
45
Points
18

Reputation:

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

valid

Well-known member
Registered
Joined
Apr 3, 2020
Messages
64
Points
18

Reputation:

I just used trial and error and found it worked.

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

Kei

Well-known member
Registered
Joined
Aug 9, 2020
Messages
45
Points
18

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

Well-known member
Registered
Joined
Aug 9, 2020
Messages
45
Points
18

Reputation:

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