MyBB Community Forums

Full Version: Colored forum user title
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I was wondering how can I enable with either bbcode or html to allow colored forum user titles. So under the username it would show the same color as the group for the user title.

This is the code I am using to set the users color which works <span style="color: #6AA85A;"><strong><em>{username}</em></strong></span> However when I attempt to use that code for the Default User Title it does not work and instead it shows (<span style="color: #6AA85A;"><strong><em>Group title</em></strong></span>)
usertitle is meant to be plain text... for security reasons html is disallowed... it makes your forum vulnerable...
i didnt say its not possible but its not recommended... you are looking at a XSS vulnerability by allowing html in usertitles.... Smile
mmadhankumar, you're right - there is a big risk to allow html in custom user titles.

But in postbit you can do something like this:

1.) Add a class in postbit / postbit_classic template to {$post['usertitle']}
Search:
{$post['usertitle']}<br />
Replace with:
 <span class="color_gid{$usergroup['gid']}">{$post['usertitle']}</span><br />


2.) Replace the color in group username styling (ACP > UserGroups) with a class
Example for user group 4:
<span class="color_gid4"><strong><em>{username}</em></strong></span>

3.) Add the css rules for this to global.css or css3.css.
.color_gid4{
	color:red;
}

Repeat step 2 & 3 for every group you need. Replace the number in class name after "color_gid" with the GroupID.
(2015-01-19, 12:51 PM)SvePu Wrote: [ -> ]mmadhankumar, you're right - there is a big risk to allow html in custom user titles.

But in postbit you can do something like this:

1.) Add a class in postbit / postbit_classic template to {$post['usertitle']}
Search:

{$post['usertitle']}<br />
Replace with:

 <span class="color_gid{$usergroup['gid']}">{$post['usertitle']}</span><br />


2.) Replace the color in group username styling (ACP > UserGroups) with a class
Example for user group 4:

<span class="color_gid4"><strong><em>{username}</em></strong></span>

3.) Add the css rules for this to global.css or css3.css.

.color_gid4{
	color:red;
}

Repeat step 2 & 3 for every group you need. Replace the number in class name after "color_gid" with the GroupID.

Thank you