Post Reply 
 
Thread Rating:
  • 1 Votes - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Default post color defined by user
Author Message
Andraž Rihtar Offline
Theme designer
Premium Users

Posts: 1,898
Joined: Aug 2009
Reputation: 9
Post: #1
Default post color defined by user
I've recently been editing and modding vBulletin for my new forum and I came accross this simple code edit which can be ported to MyBB without any complications or risks and its really easy to do it. Now enought chit-chat and lets go to work Tongue

Edited files:
  • postbit (MyBB default postbit)
  • postbit_classic (MyBB secondary postbit)
Whichever you are using, works with both. Names next to the postbits are just to help you indicate the right part of the tutorial Wink

Easiest part of this tutorial
  1. Login to Admin CP using your username and password (duh!)
  2. Navigate yourself to Custom Profile Fields (Configuration -> Custom Profile Fields)
  3. Create new profile field and make sure to set its maximum lenght to 7
  4. Save the profile field
  5. Hoover your mouse over the profile field to see its id which is important for the template edit
So, now if you go to your User CP and Edit Profile, there you should be able to see the field you just created.

Easy part of this tutorial (MyBB default postbit)
  1. Login to Admin CP using your username and password (duh!)
  2. Navigate yourself to YOURTHEME templates (Templates & Style -> Templates -> YOURTHEME)
  3. Locate Post Bit Templates and expand it (Click its name or click Expand)
  4. Click the 1st template located in Post Bit Templates, its called postbit
  5. Find this part of code:
    PHP Code:
    <div class="post_body" id="pid_{$post['pid']}">
                        {
    $post['message']}
                    </
    div
    Replace above code with this one:
    PHP Code:
    <div class="post_body" id="pid_{$post['pid']}">
                        <
    span style="color:{$post['fid<numberhere>']};">{$post['message']}</span>
                    </
    div
    Replace <numberhere> with your Custom Profile Field number!
  6. Save your edit by clicking Save and Return to Listing button
At this point you're done if you don't allow users to use vertical postbit. Follow steps bellow if you use vertical postbit as well Wink

Easy part of this tutorial (MyBB secondary postbit)
  1. Login to Admin CP using your username and password (duh!)
  2. Navigate yourself to YOURTHEME templates (Templates & Style -> Templates -> YOURTHEME)
  3. Locate Post Bit Templates and expand it (Click its name or click Expand)
  4. Click the 13th template located in Post Bit Templates, its called postbit_classic
  5. Find this part of code:
    PHP Code:
    <div id="pid_{$post['pid']}style="padding: 5px 0 5px 0;">
                    {
    $post['message']}
                </
    div
    Replace above code with this one:
    PHP Code:
    <div id="pid_{$post['pid']}style="padding: 5px 0 5px 0;">
                    <
    span style="color:{$post['fid<numberhere>']}">{$post['message']}</span>
                </
    div
    Replace <numberhere> with your Custom Profile Field number!
  6. Save your edit by clicking Save and Return to Listing button
At this point you're really finished. Enjoy this new feature of your board Wink

Demo: http://community.old-sql.net/

Credits:
  • Guy who "created" this feature for vBulletin
  • Svizy (meh) for porting it to MyBB

Andraž Rihtar - Ex-Support Team Member
02-25-2010, 05:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
euantor Offline
Posting Freak
*******
Support

Posts: 887
Joined: Jun 2009
Reputation: 7
Post: #2
RE: Default post color defined by user
Pretty simple stuff =P You could do the same with fonts etc too though ^^
02-25-2010, 05:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Andraž Rihtar Offline
Theme designer
Premium Users

Posts: 1,898
Joined: Aug 2009
Reputation: 9
Post: #3
RE: Default post color defined by user
(02-25-2010 05:57 PM)euantor Wrote:  Pretty simple stuff =P You could do the same with fonts etc too though ^^
Yeah, but that would mean a lot of textboxes (if you do it this way) and then it would need own User CP settings page Tongue

And yeah, why should we complicate it if it can be done in a easy way? Wink

Andraž Rihtar - Ex-Support Team Member
02-25-2010, 06:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
euantor Offline
Posting Freak
*******
Support

Posts: 887
Joined: Jun 2009
Reputation: 7
Post: #4
RE: Default post color defined by user
Yeah. I guess =P
02-25-2010, 08:43 PM
Visit this user's website Find all posts by this user Quote this message in a reply
mastermunj Offline
Senior Member
****

Posts: 546
Joined: Aug 2009
Reputation: 2
Post: #5
RE: Default post color defined by user
Easy and tiny tutorial!

Would have been great if a demo link where you implemented it can be available OR a screenshot of the outcome be shown 001_smile
02-25-2010, 09:42 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Andraž Rihtar Offline
Theme designer
Premium Users

Posts: 1,898
Joined: Aug 2009
Reputation: 9
Post: #6
RE: Default post color defined by user
(02-25-2010 09:42 PM)mastermunj Wrote:  Would have been great if a demo link where you implemented it can be available OR a screenshot of the outcome be shown 001_smile
I know its a little late, but still, I've added link to the forum where you can check out this feature.

I've also noticed that this doesn't work on forum portal, so I'll try to make it for portal as well Wink

Demo: http://community.old-sql.net/

Andraž Rihtar - Ex-Support Team Member
04-03-2010, 08:01 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Mikers Offline
Tutorials Team Member
***

Posts: 144
Joined: Mar 2010
Reputation: 6
Post: #7
RE: Default post color defined by user
Pretty cash tutorial there, Svizy.

Meaning it's great. 001_smile
04-05-2010, 02:21 AM
Find all posts by this user Quote this message in a reply
Don+ Offline
Member
***

Posts: 66
Joined: Aug 2010
Reputation: 0
Post: #8
RE: Default post color defined by user
Nice Big Grin
08-21-2010, 10:40 AM
Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***

Posts: 88
Joined: Aug 2010
Reputation: 0
Post: #9
RE: Default post color defined by user
thanks for this simple effective tutorial
02-24-2011, 08:46 AM
Find all posts by this user Quote this message in a reply
fma965 Offline
Member
***

Posts: 78
Joined: Jul 2011
Reputation: 0
Post: #10
RE: Default post color defined by user
thanks
08-01-2011, 05:58 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)