MyBB Community Forums

Full Version: Post background color depending on usergroup [TUTORIAL]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My last tutorial was a little long. So this one will be short!

Steps in simple:
ACP > Templates & Style > Themes > Add code > Templates > Add code
Easy in theory? Yes. Good..
OK now here is the long steps....

ACP > Templates & Style > Themes
Now choose the theme you are currently using.
Click "options"
Then "edit theme"
Now click on "showthread.css"
Add this to the VERY bottom of that:
.usergroup4 {
	color: white;
	background-color: red;
	background-image: none;
}
Let's review this code before we move on, so that way it makes sense.

".usergroup4" That little 4 number is the GID, that be found very easily, but I will not explain that.
Change that number, to the GID of the group you want to color.
Don't mind the "color: white;"

The "background-color: red;" is the color of the post background. This can be used like "red" or HEX codes such as "#FF0000"

The "background-image: none;" is the URL of a background image you want to use.

Now lets move to the next step:
Go to templates > Choose the theme you choose before
Click "Options"
Click "Expand Templates"
Now here is where it gets confusing.
There should be a big list of words.
Find the one that says "Post bit templates" easily by hitting
"CTRL+F" and typing "Post bit templates"
Now click on "Post bit"
Click on the first link called "Postbit"
Replace the current code with this:
{$ignore_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
     <tbody>
         <tr>
             <td class="tcat">
                 <div class="float_left smalltext">
                     {$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
                 </div>
                 {$post['posturl']}
             </td>
         </tr>

         <tr>
             <td class="trow1 {$unapproved_shade}">
                 <table cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
                     <tr>
                         <td class="post_avatar" width="1" style="{$post['avatar_padding']}">
                             {$post['useravatar']}
                         </td>
                         <td class="post_author">
                             <strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
                             <span class="smalltext">
                                 {$post['usertitle']}<br />
                                 {$post['userstars']}
                                 {$post['groupimage']}
                             </span>
                         </td>
                         <td class="smalltext post_author_info" width="165">
                             {$post['user_details']}
                         </td>
                     </tr>
                 </table>
             </td>
         </tr>

         <tr>
             <td class="trow2 post_content usergroup{$post['usergroup']} {$unapproved_shade}">
                 <span class="smalltext"><strong>{$post['icon']}{$post['subject']} {$post['subject_extra']}</strong></span>

                 <div class="post_body" id="pid_{$post['pid']}">
                     {$post['message']}
                 </div>
                 {$post['attachments']}
                 {$post['signature']}

                 <div class="post_meta" id="post_meta_{$post['pid']}">
                 {$post['iplogged']}
                 </div>
             </td>
         </tr>

         <tr>
             <td class="trow1 post_buttons {$unapproved_shade}">
                 <div class="author_buttons float_left">
                     {$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}
                 </div>
                 <div class="post_management_buttons float_right">{$post['button_spam']}{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
                 </div>
             </td>
         </tr>
     </tbody>
</table>
I hope this helps you, and I will help you with any problems you have (hopefully)

NOTE!!!!!! I DID NOT CREATE THIS CODE!!! ALL CREDIT GOES TO LEEFISH, THE ONLY THING I DID WAS ADVERTISE IT!!!!

By the way: forget the short.
Looks curious Smile
It is quite short Big Grin

Thank you for the credit.
any screen what is it and how does it look?
Dear i have done what ever is written in your post but even then i am having same image in my posts as old one. I mean this thing did not work for me.
here is the link to my forum
http://www.youthsden.com

1 more query.
Will this thing edit all posts made by that user group or will it just edit new posts which you make after editing ??