MyBB Community Forums

Full Version: Template Conditionals
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Attempting to use template conditionals to create a postbit background for uid=1, having a bit of trouble at the moment.

For any of you wanting to know what I am trying to do: http://invision-virus.com/forum/index.ph...ckgrounds/

Although that link is more towards IP.Board while I am obviously using myBB.

If someone could help me with this it would be greatly appreciated.

Regards,

Polymath
Post the code you're attempting to use for this. You have the Template Conditionals plugin installed correct? That is required.
(2018-04-22, 02:02 AM)Corey H Wrote: [ -> ]Post the code you're attempting to use for this. You have the Template Conditionals plugin installed correct? That is required.

I'm attempting to have this code changed to work with myBB.

[color=#282828][size=x-small][color=#000088]<style[/color] [color=#660066]type[/color][color=#666600]=[/color][color=#008800]"text/css"[/color][color=#000088]>[/color]
[color=#000088]<if[/color] [color=#660066]test[/color][color=#666600]=[/color][color=#008800]"$post['author']['member_group_id'] == MEMBER GROUP ID"[/color][color=#000088]>[/color][color=#000000]
#post_id_{$post['post']['pid']} .author_info {
background-image: url(IMAGE URL);
background-repeat: no-repeat;
}
[/color][color=#000088]</if>[/color]
[color=#000088]</style>[/color][/size][/color]
[color=#282828][size=x-small][color=#000088]
Just add a class based on UID:
class="normal<if (int)$post['uid'] === 1 then> premium</if>"

Using the plugin Corey mentioned.
(2018-04-25, 02:43 AM)Omar G. Wrote: [ -> ]Just add a class based on UID:
class="normal<if (int)$post['uid'] === 1 then> premium</if>"

Using the plugin Corey mentioned.

I am currently using the template conditionals plugin already.

Could you paste the code that I should edit to make it work?
You need to modify the postbit/_classic template and global.css style sheet for what you want to do.
(2018-04-26, 12:57 AM)Omar G. Wrote: [ -> ]You need to modify the postbit/_classic template and global.css style sheet for what you want to do.

I meant like the full code I should copy and paste. Edited properly.
You didn't need a plugin. Wink

What do you want style - author or post content area??
(2018-04-27, 10:00 PM)SvePu Wrote: [ -> ]You didn't need a plugin. Wink

What do you want style - author or post content area??

Author content area.

Like such: https://gyazo.com/bea4395a820cab6d4ce83d0cdb574d8a
Ok...then search in theme template "postbit" for:
<div class="post_author">

replace there all with:
<div class="post_author post_author_background_{$post['uid']}">



and in "postbit_classic" for:
<div class="post_author scaleimages">

replace there all with:
<div class="post_author scaleimages post_author_background_{$post['uid']}">



After that you can style the background for every single user id in theme global.css with class "post_author_background_X" - while the X stands for the specific UID

e.g for UID 1
.post_author_background_1 {
 background: red !important;
} 
or
.post_author_background_1 {
 background: url(IMAGE-URL) no-repeat 50% 50% / cover !important;
} 

(the !important is important)
Pages: 1 2