Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Class Colors Function for 2.08
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2012-12-29 09:00:05
The original mode can be found here: [url="http://www.torrenttrader.pw/topic/12259-class-colors-function"]http://www.torrentt...colors-function[/url] and all the credit belongs to cooly.
I just made some changes.

In backend/functions.php after this code:

$GLOBALS['tstart'] = array_sum(explode(" ", microtime()));
Add:

//start class colors function
function class_user($name) {
global $site_config;
$a ="SELECT class, donated, warned, enabled FROM `users` WHERE username ='".$name."'";
$res = SQL_Query_exec($a);
$classy = @mysql_fetch_row($res);
switch ($classy[0]) {

case 7: // Administrator
$col = "".$site_config["administrator_color"]."";
break;
case 6: // Super Moderator
$col = "".$site_config["super_moderator_color"]."";
break;
case 5: // Moderator
$col = "".$site_config["moderator_color"]."";
break;
case 4: // Uploader
$col = "".$site_config["uploader_color"]."";
break;
case 3: // VIP
$col = "".$site_config["vip_color"]."";
break;
case 2: // Power User
$col = "".$site_config["power_user_color"]."";
break;
case 1: // User
$col = "".$site_config["user_color"]."";

}if($classy[1]>0){
$star="<img src='".$site_config[SITEURL]."/images/star.png' alt='donated' border='0'>";
}else{ $star="";}
if($classy[2]=="yes"){
$warn="<img src='".$site_config[SITEURL]."/images/warned.png' alt='warned' border=0>";
}else{ $warn=""; }
if($classy[3]=="no"){
$disabled="<img src='".$site_config[SITEURL]."/images/disabled.png' alt='disabled' border=0>";
}else{ $disabled=""; }
return unesc("<font color='".$col."'>".$name."".$star."".$warn."".$disabled."</font>");
}
//end class colors function
And in backend/config.php add this code:

// class colors
$site_config['administrator_color'] = '#009AFF'; // Administrator
$site_config['super_moderator_color'] = '#00C000'; // Super Moderator
$site_config['moderator_color'] = '#007F00'; // Moderator
$site_config['uploader_color'] = '#00A49E'; // Uploader
$site_config['vip_color'] = '#7FB600'; // VIP
$site_config['power_user_color'] = '#BD8B00'; // Power User
$site_config['user_color'] = '#856A00'; // User
Now all you need to do is to change any "username" code, anywhere is it written in the source code
And that is not so simple, for example:

$row['user']
Will be:

".class_user($row['user'])."
To help with more examples, here are the changes made in forums.php on my tracker:

".class_user($a[username])."
".class_user($arr[username])."
".class_user($arr2[username])."
".class_user($user[username])."
".class_user($lastposter)."
$postername = class_user($arr2["username"]);
[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6420"]images.zip[/url]

images.zip
Download
colors.png
colors.png
Unknown User
2012-12-29 10:35:27
cool it give me more information about class colors function and how to, and what to change  :)  Thank you so much

".class_user($a[username])."

".class_user($arr[username])."

".class_user($arr2[username])."

".class_user($user[username])."

".class_user($lastposter)."

$postername = class_user($arr2["username"]);

very nice
2012-12-29 14:51:53
#1 big thanks!! :D
2012-12-30 03:23:35
very nice BigMax, thank you :)
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Unknown User
2013-01-08 20:36:12
it works great.
Unknown User
2013-01-14 11:32:33
hi to all

here I turn on a tt-svn, but I can not find the lines:

$ row ['user'] to modify. "class_user ($ row ['user'])."

I have to look it in the header or elsewhere

thank you in advance for your reply.

salut a tous

voila je tourne sur un tt-svn , mais je ne trouve pas les lignes:

$row['user'] à modifier par ".class_user($row['user'])."

je dois chercher ceci dans le header ou ailleurs

merci d avance pour votre reponse.
Unknown User
2013-01-14 20:35:34
You have to find it, where your username is showing, per example in forums.php
Unknown User
2013-01-18 14:25:58
a small error



if($classy[3]=="no"){

$warn="<img src='".$site_config[sITEURL]."/images/disabled.png' alt='disabled' border=0>";

}else{ $disabled=""; }




change for





if($classy[3]=="no"){

$disabled="<img src='".$site_config[sITEURL]."/images/disabled.png' alt='disabled' border=0>";

}else{ $disabled=""; }

Unknown User
2013-01-21 19:37:45
THANKs!
Unknown User
2013-03-29 13:49:17
Anyone know why this error mean?

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in F:EasyPHPwwwTMFtranckbackendfunctions.php on line 1247



if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == ".class_user($row['user']).")

   $edit = '[<a href="comments.php?id='.$row["id"].'&amp;type='.$type.'&amp;edit=1">Edit</a>]&nbsp;';

Unknown User
2013-04-16 22:22:54
Fixed Error

change this

".class_user($row['user'])."

with this


".class_user($row['username'])."
Unknown User
2013-04-17 00:52:36
this will not work..

if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == ".class_user($row['user']).") $edit = '[<a href="comments.php?id='.$row["id"].'&amp;type='.$type.'&amp;edit=1">Edit</a>]&nbsp;';

in  that case you should use

  if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == $row['username']) 
 $edit = '[<a href="comments.php?id='.$row["id"].'&amp;type='.$type.'&amp;edit=1">Edit</a>]&nbsp;';
Unknown User
2013-04-17 01:56:22
i think it's userid  instead  of username


if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == $row['userid'])
 $edit = '[<a href="comments.php?id='.$row["id"].'&amp;type='.$type.'&amp;edit=1">Edit</a>]&nbsp;';
Unknown User
2013-04-17 03:18:16
I think thib is right.. Hard knowing without out the code around it or atleast the function its being called from..

from his original post it looks like user... so change

if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == $row['username']) 
 $edit = '[<a href="comments.php?id='.$row["id"].'&amp;type='.$type.'&amp;edit=1">Edit</a>]&nbsp;';

to
if ($type == "torrent" && $CURUSER["edit_torrents"] == "yes" || $type == "news" && $CURUSER["edit_news"] == "yes" || $CURUSER['id'] == $row['user']) 
 $edit = '[<a href="comments.php?id='.$row["id"].'&amp;type='.$type.'&amp;edit=1">Edit</a>]&nbsp;';
Unknown User
2013-04-30 09:20:19
".class_user($a[username])."
".class_user($arr[username])."
".class_user($arr2[username])."
".class_user($user[username])."
".class_user($lastposter)."
$postername = class_user($arr2["username"]);
What and where i change in forums.php? Thx.  :)
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728