MyBB Community Forums

Full Version: Different post background/badge for "thread starter"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I use template conditionals plugin so it should be easier. I would like to change background color for all postbit_classic for thread authors.

I assume, it should be something like this (I use different background color for forum stuff). I am not sure wher to put another CSS for background color

<if $thread['uid'] == $post['uid'] then><div class="post classic post_{$usergroup['gid']} {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
<else>
<div class="post classic post_{$usergroup['gid']} {$unapproved_shade}" style="{$post_visibility}" id="post_{$post['pid']}">
</if>


Is there any easier better way? Thank you!
For this no plugin is needed if you have template conditionals mod.

I just need to help with CSS, anyway I will use another approach (thx for help @mmadhankumar!) I will share it here
You could just use the group id variable (for instance, postbg_{$post['usergroup']}) within a class you put into the post, and then just have a style for each usergroup that you want different. Like .postbg_4 would dictate a poster who is an admin.

Only thing is, it just accounts for the main group. However, no conditionals or plugins necessary. I'm doing this to make CSS forum ranks as well.
(2016-03-09, 12:13 PM)Lost Eventide Wrote: [ -> ]You could just use the group id variable (for instance, postbg_{$post['usergroup']}) within a class you put into the post, and then just have a style for each usergroup that you want different. Like .postbg_4 would dictate a poster who is an admin.

Only thing is, it just accounts for the main group. However, no conditionals or plugins necessary. I'm doing this to make CSS forum ranks as well.

OK, I dont need to change background for every usergroup... I just need change background for thread starter (author). It is something different Smile
this adds a badge to the thread starter(as per your PM)... check if this works...

add this just above the opening div of post_author

<if $thread['uid'] == $post['uid'] then>
<div class="tstarter">Author</div>
</if>


then add this css...

.tstarter {
    width: 90px;
    text-align: center;
    height: 0px;
    font-weight: bold;
    font-family: arial;
    color: #ffffff;
    transform: rotate(-45deg);
    position: relative;
    top: 18px;
    left: -230px;
    display: inline-block;
    }


.tstarter:before {
    content: '';
    position: absolute;
    left: 0;
    z-index: -1;
}

.tstarter:before {
    box-sizing: border-box;
    width: 100%;
    height: 0px;
    border-width: 0 20px 20px 0;
    border-color: green transparent;
    border-style: solid;
}

PS: it is assumed you are using classic postbit on the default theme and the template conditional plugin... the values has to be changed as per your theme if you are on a different theme...
Amazing! Really cool! Thank you very much.

EDIT: So for fluid MyBB default theme I have to modify "left" attribute?
EDIT2: Ok, nevermind. "left" set to -20% and works fine!
Just so you know, you wouldn't need to make a style for every usergroup - if you just style the admin group it would be the only one that's altered. The rest you can leave untouched and they wouldn't change as long as you keep the original post styling intact - they wouldn't have any styling.

You can have multiple classes for a div as long as you separate them with a space (as in <div class="class1 class2">, which is incredibly handy. Alternatively, you can just have the other usergroup classes all share the same style by separating them with commas in the CSS (.usergroup_4, .usergroup_7, .usergroup_6 {Styles}).

Figured I'd clarify in case someone who doesn't want to use the template conditionals happens to be looking for the same thing and this comes up in a search =3