Solved: 5 Years, 2 Months ago [How To?] Ignore User Profile Field If Empty
#1
Solved: 5 Years, 2 Months ago
I'm trying to add in some cool areas for others to use to be able to stylize their profile page to their liking so its not just the normal ol' theme.

BUT for example:
When I add in the user custom field for "Body Background Image" and they do not fill it out with an image, the body background goes to black.
I want for it to instead of going to black if the field is empty, to just not do anything at all (as if the field wasn't even there).

I've seen this done on other MyBB forums so I know it's possible.

Here's my code I'm using for the body background image:
<body style="background-image: url('{$userfields['fid19']}');"></body>

http://ltts.wolvenlore.com/index.php <-- Forum
Reply
#2
Solved: 5 Years, 2 Months ago
You need a plugin like Template Conditionals which I mentioned in your previous topic: http://mybbhacks.zingaburga.com/showthread.php?tid=464

<body <if $userfields['fid19'] then>style="background-image: url('{$userfields['fid19']}');"</if>></body>
Reply
#3
Solved: 5 Years, 2 Months ago
Okay, I'll go download that plugin! Thanks!

If I wanted to use these extra conditionals would I be able to implement them into CSS or would I have to use html-->style like in the <body> tag?
Reply
#4
Solved: 5 Years, 2 Months ago
Only in templates.
Reply
#5
Solved: 5 Years, 2 Months ago
I mean like in the template would I be able to put it in CSS like:

<style>
body {userfield for bg in here}
</style>
Reply
#6
Solved: 5 Years, 2 Months ago
Still looking for an answer to previous question.
Quote:I mean like in the template would I be able to put it in CSS like:

<style>
body {userfield for bg in here}
</style>

If you have any suggestions or answers that would be lovely!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)