e107Hacks.org

Home | Forum | Downloads | Upload | Hack | Members | Links | Add | Search

107Hacks.org :: Forums :: Hack Request & Discussion - Public :: Hack discussions

Repost by me from -LINK- :

A way to automaticaly color the posts made by forum moderators.
Like they use @ blizzard : -LINK-

Or maybe to color a post depending on userclass the poster has.
All posts of sixke (aka pinky) are turned to pink 

Demo : -LINK-

Lets make a shortcode postcolor.sc
 
//  set global to $post_info  for forum & $user for pr ofile
global $post_info, $user;

// -- > EDIT THE FOLLOWING <--
//  use the following to lis t the classes with their  pictures, from most impor tant (1)  to least important (4)


$rank_no1 = " Forum_color_blue"; //  this is the most importa nt userclass
$rank_no1_pic = " <b><font color='#2A55FF' >"; //  this is the picture that  needs to be showed with  this userclass on forum/ profile (examples used)

$rank_no2 = " Forum_color_red";
$rank_no2_pic = " <b><font color='#E91515' >";

$rank_no3 = " Forum_color_purple";
$rank_no3_pic = " <b><font color='#7F2AFF' >";
// --> STOP EDIT <--


if(check_class($rank_no3,  $post_info['user_class'] , TRUE)  || check_class($rank_no3 , $user['user_class'] , TRUE))
{
$output = "$rank_no3_pic" ;
}
if(check_class($rank_no2,  $post_info['user_class'] , TRUE)  || check_class($rank_no2 , $user['user_class'] , TRUE))
{
$output = "$rank_no2_pic" ;
}
if(check_class($rank_no1,  $post_info['user_class'] , TRUE)  || check_class($rank_no1 , $user['user_class'] , TRUE))
{
$output = "$rank_no1_pic" ;
}
return $output;

// End of code extract


Make userclasses named:
Forum_color_blue
Forum_c olor_red
Forum_color_purp le
(+ add the forum moderator to one of the userclasses)

And replace TWO TIMES in forum_viewtopic_template. php
(can be found in /e107_plugins/forum/ templates/ )

Replace :
 
{POST}


With :
 
{POSTCOLOR}{POST}</ font></b>


The end

I also made the moderators posts background a diffrent colour.
But, how to you have to figure out yourself 
(It isn't that hard)


I hope this is helpfull.
Greetz and enjoy
RS