MyBB Community Forums

Full Version: Is possible to add color to the thread?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, i was wondering if is possible to add color to the tittle of a thread, like on vbulletin...
using [color][/color] for example
is possible?
Not by default. however
do this.
Go to inc/functions_post.php
find:
$post['subject'] = htmlspecialchars_uni(dobadwords($post['subject']));
add under:
$post['subject'] = preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si", "<span style=\"color: $1;\">$2</span>", $post['subject']);
Then go to forumdisplay.php
find:
$thread['subject'] = htmlspecialchars_uni(dobadwords($thread['subject']));
add under:
$thread['subject'] = preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si", "<span style=\"color: $1;\">$2</span>", $thread['subject']);
Find:
$lastpostsubject = htmlspecialchars_uni(dobadwords($lastpostsubject));
Add under:
$lastpostsubject = preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si", "<span style=\"color: $1;\">$2</span>", $lastpostsubject);
$lastpostsubject = preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)#si", "<span style=\"color: $1;\">$2</span>", $lastpostsubject);
Find:
$fulllastpostsubject = htmlspecialchars_uni(dobadwords($fulllastpostsubject));
Add under:
$fulllastpostsubject = preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si", "<span style=\"color: $1;\">$2</span>", $fulllastpostsubject);
$fulllastpostsubject = preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)#si", "<span style=\"color: $1;\">$2</span>", $fulllastpostsubject);
uhm that doesnt seems to work, i get this error:

Warning: main(): Unable to access ./inc/functions_post.php in /www/sites/1/iespana.es/t/h/theanimangaworld/site/index.php on line 18

Warning: main(./inc/functions_post.php): failed to open stream: No such file or directory in /www/sites/1/iespana.es/t/h/theanimangaworld/site/index.php on line 18

Fatal error: main(): Failed opening required './inc/functions_post.php' (include_path='.:/www/usr/lib/php') in /www/sites/1/iespana.es/t/h/theanimangaworld/site/index.php on line 18
Updated my first post to cover more.
About your error, my changes couldn't have thrown that error Confused
Ok, but crakter there are couple of things.
1st, the navigation crumb isn't changed, same as the thread title in the tcat, it will display, [ color=red ]subject[/color].

for that reason, open ./showthread.php

find
PHP Code:
<?php 
addnav
($thread['subject'], "showthread.php?tid=$tid");
above it add
PHP Code:
<?php 
$titletop
= preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si", "$2", $thread['subject']);
$thread['subject'] = preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si", "<span style=\"color: $1;\">$2</span>", $thread['subject']);

the other thing is the thread icon, it is getting messed. to fix that.

in ./forumdisplay.php find

PHP Code:
<?php 
$thread
['subject'] = htmlspecialchars_uni(dobadwords($thread['subject']));

below it add

PHP Code:
<?php 
$iconsub
=preg_replace("#\[color=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/color\]#si", "$2", $thread['subject']);

then in the forumdisplay_thread template
find
Code:
alt="$thread[subject]"��

replace with
Code:
alt="$iconsub"

a third this which is the thread title in the Internet browser top header. a part of its fix is in the previous fix i mentioned about showthread.php

but you also need to edit showthread template and replace
Code:
<title>$thread[subject]</title>

with

Code:
<title>$titletop</title>


regards
so if i do what zaher said this is going to work?