This is an Medal system someone requested and an updated class_user function from [url="https://www.torrenttrader.pw/topic/17452-class-colors-function-for-208"]https://www.torrentt...unction-for-208[/url]
1st the sql:
ALTER TABLE `groups` ADD `Color` VARCHAR( 7 ) NOT NULL DEFAULT '#000000' AFTER `level` ;
UPDATE `groups` SET `Color` = '#BD8B00' where group_id = 2;
UPDATE `groups` SET `Color` = '#7FB600' where group_id = 3;
UPDATE `groups` SET `Color` = '#00A49E' where group_id = 4;
UPDATE `groups` SET `Color` = '#007F00' where group_id = 5;
UPDATE `groups` SET `Color` = '#00C000' where group_id = 6;
UPDATE `groups` SET `Color` = '#009AFF' where group_id = 7;
People might ask why move colors into the db... Well it keeps the colors of your site for classes looking the same if you use the new class_user function to display the username instead of having multi color arrays or ifs in different pages just to display the color!
next add the following functions in backend/functions.php
replacing your current class_user function if you have 1
if you dont have an class_user function then add before the very last
?>
Fixed Function Below!!
// Auto Uploader rank function (Author: ArcticWolf)
function auto_rank_icon($uploaded, $downloaded, $level)
{
$tb = 1024 * 1024 * 1024 * 1024;
// Config
$minup0 = .5 * $tb;
$minup1 = 1 * $tb;
$minup2 = 2 * $tb;
$minup3 = 3.5 * $tb;
$minup4 = 5.5 * $tb;
$minup5 = 8 * $tb;
$minup6 = 15 * $tb;
// Config End
$icon1 = "legend_stjarna_brons.png";
$icon2 = "legend_stjarna_silver.png";
$icon3 = "legend_stjarna_guld.png";
$icon4 = "krona_brons.png";
$icon5 = "krona_silver.png";
$icon6 = "krona_guld.png";
$icon7 = "diamant.png";
if ($uploaded >= $minup6 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon7 . "" alt='$icon7' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup5 && $uploaded < $minup6 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon6 . "" alt='$icon6' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup4 && $uploaded < $minup5 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon5 . "" alt='$icon5' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup3 && $uploaded < $minup4 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon4 . "" alt='$icon4' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup2 && $uploaded < $minup3 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon3 . "" alt='$icon3' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup1 && $uploaded < $minup2 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon2 . "" alt='$icon2' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup0 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon1 . "" alt='$icon1' border=\"0\"/>";
return $uprankr;
}
return "";
}
then upload the files in the attached zip to your site into images with dir!!!!!!
[url="http://51.15.8.36/applications/core/interface/file/attachment.php?id=6479"]icons.zip[/url]
Now here comes the harder part.. displaying it... Basically any place the displays username like
$arr[username]
change to
class_user($arr[username])
like stock shoutbox.php would be change
$row['user']
to
class_user($row['user'])
and blocks/login_block.php
change
$CURUSER["username"]
to
class_user($CURUSER["username"])
Basically like any place in phps that uses
$CURUSER["username"]
change to
class_user($CURUSER["username"])
Spank-D has some others you could change listed
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"]);
there is like dozons others you could change!!! but i am not listing them all here, its not really that hard and learn to test!!!!!
If you really need help changing something post the page in question and someone might help you!!!!
An few of the other places you could change is in account-details, account.php... its not really that hard!!! learn to read, copy/paste and then test you should be OK!!
account-details.php would be change
$user["username"]
to
class_user($user["username"])
account.php would be change
<b><b><?php echo T_("USERNAME"); ?>:</b> <?php echo $CURUSER["username"]; ?><br />
to
<b><?php echo T_("USERNAME"); ?>:</b> <?php echo class_user($CURUSER["username"]); ?><br />
PROOF!!!!

[ATTACH]2066._xfImport[/ATTACH]
1st the sql:
ALTER TABLE `groups` ADD `Color` VARCHAR( 7 ) NOT NULL DEFAULT '#000000' AFTER `level` ;
UPDATE `groups` SET `Color` = '#BD8B00' where group_id = 2;
UPDATE `groups` SET `Color` = '#7FB600' where group_id = 3;
UPDATE `groups` SET `Color` = '#00A49E' where group_id = 4;
UPDATE `groups` SET `Color` = '#007F00' where group_id = 5;
UPDATE `groups` SET `Color` = '#00C000' where group_id = 6;
UPDATE `groups` SET `Color` = '#009AFF' where group_id = 7;
People might ask why move colors into the db... Well it keeps the colors of your site for classes looking the same if you use the new class_user function to display the username instead of having multi color arrays or ifs in different pages just to display the color!
next add the following functions in backend/functions.php
replacing your current class_user function if you have 1
if you dont have an class_user function then add before the very last
?>
function class_user($name)
{
global $site_config;
$a = "SELECT u.class, u.donated, u.warned, g.Color, g.level, u.uploaded, u.downloaded FROM `users` `u` INNER JOIN `groups` `g` ON g.group_id=u.class WHERE username ='" . $name . "'";
// echo "Query a".$a."<br />";
$res = SQL_Query_exec($a);
$classy = @mysql_fetch_array($res);
$gcolor = $classy['Color'];
if ($classy['donated'] > 0) {
$star = "<img src='" . $site_config[SITEURL] . "/images/icons/star.gif' alt='donated' border='0'>";
} else {
$star = "";
}
if ($classy['warned'] == "yes") {
$warn = "<img src='" . $site_config[SITEURL] . "/images/icons/warn.gif' alt='warned' border='0'>";
} else {
$warn = "";
}
$rang = auto_rank_icon($classy['uploaded'], $classy['downloaded'], $classy['level']);
return unesc("<font color='" . $gcolor . "'>" . $name . "" . $star . "" . $warn . "" . $rang . "</font>");
}
Fixed Function Below!!
// Auto Uploader rank function (Author: ArcticWolf)
function auto_rank_icon($uploaded, $downloaded, $level)
{
$tb = 1024 * 1024 * 1024 * 1024;
// Config
$minup0 = .5 * $tb;
$minup1 = 1 * $tb;
$minup2 = 2 * $tb;
$minup3 = 3.5 * $tb;
$minup4 = 5.5 * $tb;
$minup5 = 8 * $tb;
$minup6 = 15 * $tb;
// Config End
$icon1 = "legend_stjarna_brons.png";
$icon2 = "legend_stjarna_silver.png";
$icon3 = "legend_stjarna_guld.png";
$icon4 = "krona_brons.png";
$icon5 = "krona_silver.png";
$icon6 = "krona_guld.png";
$icon7 = "diamant.png";
if ($uploaded >= $minup6 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon7 . "" alt='$icon7' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup5 && $uploaded < $minup6 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon6 . "" alt='$icon6' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup4 && $uploaded < $minup5 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon5 . "" alt='$icon5' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup3 && $uploaded < $minup4 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon4 . "" alt='$icon4' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup2 && $uploaded < $minup3 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon3 . "" alt='$icon3' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup1 && $uploaded < $minup2 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon2 . "" alt='$icon2' border=\"0\"/>";
return $uprankr;
} elseif ($uploaded >= $minup0 && $uploaded >= $downloaded) {
$uprankr = "<img src='/images/icons/' . $icon1 . "" alt='$icon1' border=\"0\"/>";
return $uprankr;
}
return "";
}
then upload the files in the attached zip to your site into images with dir!!!!!!
[url="http://51.15.8.36/applications/core/interface/file/attachment.php?id=6479"]icons.zip[/url]
Now here comes the harder part.. displaying it... Basically any place the displays username like
$arr[username]
change to
class_user($arr[username])
like stock shoutbox.php would be change
$row['user']
to
class_user($row['user'])
and blocks/login_block.php
change
$CURUSER["username"]
to
class_user($CURUSER["username"])
Basically like any place in phps that uses
$CURUSER["username"]
change to
class_user($CURUSER["username"])
Spank-D has some others you could change listed
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"]);
there is like dozons others you could change!!! but i am not listing them all here, its not really that hard and learn to test!!!!!
If you really need help changing something post the page in question and someone might help you!!!!
An few of the other places you could change is in account-details, account.php... its not really that hard!!! learn to read, copy/paste and then test you should be OK!!
account-details.php would be change
$user["username"]
to
class_user($user["username"])
account.php would be change
<b><b><?php echo T_("USERNAME"); ?>:</b> <?php echo $CURUSER["username"]; ?><br />
to
<b><?php echo T_("USERNAME"); ?>:</b> <?php echo class_user($CURUSER["username"]); ?><br />
PROOF!!!!

[ATTACH]2066._xfImport[/ATTACH]
