Color the staff author information on MyBB posts

In this tutorial, I’ll teach you how to give the author information of certain usergroups a special background color. It’ll look like this:
MyBB Thread Background
Instead of this:

MyBB Post Background

We can achieve this effect for each usergroup. Moderators for example could have a light blue background for their author information, VIPs could have a light yellow background and so on. You can also use background images.
We will use simple template edits for this modification instead of a plugin.

Open your Admin CP and browse the section Templates & Style. Click on the Templates tab and find your currently used themes templates:
Your MyBB Theme TemplatesFind the postbit template inside the Postbit Templates Group:
MyBB Postbit Templates
Find the following line:

 <div class="post_author">

and change it to this:

 <div class="post_author pbg{$usergroup['gid']}">

Next step is finding the postbit classic template and replace this line:

 <div class="post_author scaleimages">

with this line:

 <div class="post_author scaleimages pbg{$usergroup['gid']}">

Now return to the section Templates & Style. Click on the Themes tab and find your currently used theme.
Open the global.css:
MyBB Theme Global.css

Click on Edit Stylesheet: Advanced Mode. At the bottom of the textarea, add the following code:

.pbg4 { background-color: lightgreen !important; }

This will turn the background of the author information on posts by the usergroup with the ID 4 into a light green color.
ID 4 is the admin group by default. We need the !important expression to overwrite existing CSS definitions here.

If you want to change the color of the moderators group (default ID is 6) to a light yellow, add this:

.pbg6 { background-color: lightyellow !important; }

You can use hex-colors too of course. #000000 would equal a black background in this case. Using the CSS parameter background-image you can embedd background images for certain usergroups too.

Using different background colors for certain usergroups makes it easy for visitors to judge the quality of a reply and will support the visibility of your staffs posts. Visitors will be able to find better information with ease and that will help you with your MyBB Business.

If you have any questions or need support implementing this, please use the comments section!

Leave a Reply

Your email address will not be published.