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
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2010-05-20 12:17:04
Ok I have seen that users have been using the sql calls in alot of files just to collect class colors and when they have to change something it means having to go through all the different files to add new classes into it so it matches. So i made a function from the code you have all been using so it can be called from any file then theres only functions.php to change anytime u add something new.

Updated with star and warned icon!

In functions.php add... note to change to match your current classes

:blink:





more examples login block....

function class_user($name)

{

global $site_config;

$a ="SELECT class, donated, warned FROM `users` WHERE username ='".$name."'";

$res = mysql_query($a);

$classy = @mysql_fetch_row($res);

switch ($classy[0]) {

case 8: // SYS:

$col = "#15CFCD";

break;

case 7: // ADMINISTRATORSYS:

$col = "#ff0000";

break;

case 6: // Administrator

$col = "teal";

break;

case 5: // Super Moderator

$col = "#3300CC";

break;

case 4: // Moderator

$col = "#006600";

break;

case 3: // VIP

$col = "#FFFF00";

break;

case 2: // Uploader

$col = "#33FF33";

break;

default: // User

$name = $name;

}

if ($classy[1]>0){

$star="<img src='".$site_config[SITEURL]."/images/star.gif' alt='donated' border='0'>";

}else{

$star="";

}

if($classy[2]=="yes"){

$warn="<img src='".$site_config[SITEURL]."/images/warn.gif' alt='warned' border=0>";

}else{

$warn="";

}



return unesc("<font color='".$col."'>".$name."".$star."".$warn."</font>");

 

}
Now all you need to do is for any "username" code for example  $row['user'] in shoutbox would now be




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





or





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







depending on whether ' or " starts the echo or print

begin_block("".class_user($CURUSER[username])."");







torrenttable....





echo "<a href='account-details.php?id=$row[owner]'>".class_user($row[username])."</a>";



Capture.GIF
Capture.GIF
Unknown User
2010-05-20 16:40:35
fonctionne a merveille tr
Unknown User
2010-05-20 17:13:39
"lesstefs79, post: 63496":
fonctionne a merveille tr
Capture.GIF
Capture.GIF
Unknown User
2010-05-20 19:11:16
"cooly, post: 63498":
yes but please try to speak english  :blink:
open torrents.php search...

if ($count) {

list($pagertop, $pagerbottom, $limit) = pager(20, $count, "torrents.php?" . $addparam);

$query = "SELECT
add in...




users.donated,







open functions torrentable and search...





case 'uploader':

echo "<td class=ttable_col$x align=center>";





add after..





if($row[donated]>0){

$img="<img src='".$site_config[SITEURL]."/images/star.gif' border='0'>";

}else{

$img="";

}





then...

($row[username])."".$img."



".class_user




sory mate but this part gose where?

($row[username])."".$img."

".class_user
Unknown User
2010-05-20 19:24:49
Its in functions the torrent table function after these lines..

if (($row["anon"] == "yes" || $row["privacy"] == "strong") && $CURUSER["id"] != $row["owner"] && $CURUSER["edit_torrents"] != "yes")

echo "Anonymous";

elseif ($row["username"])
Unknown User
2010-05-20 22:16:12
First post updated with star and warned in the same function if u added star to torrents remove that part :blink:
Unknown User
2010-05-26 22:40:21
"cooly, post: 63492":
Ok I have seen that users have been using the sql calls in alot of files just to collect class colors and when they have to change something it means having to go through all the different files to add new classes into it so it matches. So i made a function from the code you have all been using so it can be called from any file then theres only functions.php to change anytime u add something new.
Updated with star and warned icon!

In functions.php add... note to change to match your current classes

:blink:





more examples login block....

function class_user($name)

{

global $site_config;

$a ="SELECT class, donated, warned FROM `users` WHERE username ='".$name."'";

$res = mysql_query($a);

$classy = @mysql_fetch_row($res);

switch ($classy[0]) {

case 8: // SYS:

$col = "#15CFCD";

break;

case 7: // ADMINISTRATORSYS:

$col = "#ff0000";

break;

case 6: // Administrator

$col = "teal";

break;

case 5: // Super Moderator

$col = "#3300CC";

break;

case 4: // Moderator

$col = "#006600";

break;

case 3: // VIP

$col = "#FFFF00";

break;

case 2: // Uploader

$col = "#33FF33";

break;

default: // User

$name = $name;

}

if ($classy[1]>0){

$star="<img src='".$site_config[SITEURL]."/images/star.gif' alt='donated' border='0'>";

}else{

$star="";

}

if($classy[2]=="yes"){

$warn="<img src='".$site_config[SITEURL]."/images/warn.gif' alt='warned' border=0>";

}else{

$warn="";

}



return unesc("<font color='".$col."'>".$name."".$star."".$warn."</font>");

 

}
Now all you need to do is for any "username" code for example  $row['user'] in shoutbox would now be




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





or





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







depending on whether ' or " starts the echo or print

begin_block("".class_user($CURUSER[username])."");







torrenttable....





echo "<a href='account-details.php?id=$row[owner]'>".class_user($row[username])."</a>";







which location to insert these lines?

Thanks  ;)
Unknown User
2010-05-27 00:55:03
buzz me on msn later 2day and i will do it for you
Unknown User
2010-05-27 13:08:28
"djhowarth, post: 63585":
buzz me on msn later 2day and i will do it for you


:blink:   thanks my friend...
Unknown User
2010-05-29 11:57:34
you place the main code into functions.php , and change the code anywhere you want color , star , warned gif to appear , like torrenttable , shoutbox and useronline
Unknown User
2010-06-14 11:18:25
How could i get this to work with this   :blink:

$lastposter = ($lastposter_id ? "<a href='account-details.php?id=$lastposter_id'>$row[topic_last_poster_name]</a>" : $row["topic_last_poster_name"]);



i want to add user colors to last poster on the forum block.

cheers
Unknown User
2010-06-14 13:49:48
in forums php find in /// GET NAME OF LAST POSTER ///

$username = "<a href=account-details.php?id=$userid>".($arr[username])."</a>";



change to



$username = "<a href=account-details.php?id=$userid>".class_user($arr[username])."</a>";





and same with author find in /// GET NAME OF THE AUTHOR ///



$author = "<a href=account-details.php?id=$topic_userid>".($arr[username])."</a>";



and change to



$author = "<a href=account-details.php?id=$topic_userid>".class_user($arr[username])."</a>";
Unknown User
2010-06-14 15:28:01
"SJC2TK, post: 63840":
in forums php find in /// GET NAME OF LAST POSTER ///

$username = "<a href=account-details.php?id=$userid>".($arr[username])."</a>";
change to


$username = "<a href=account-details.php?id=$userid>".class_user($arr[username])."</a>";





and same with author find in /// GET NAME OF THE AUTHOR ///



$author = "<a href=account-details.php?id=$topic_userid>".($arr[username])."</a>";



and change to



$author = "<a href=account-details.php?id=$topic_userid>".class_user($arr[username])."</a>";




My bad   :blink:   i should have mentioned i run the phpbb modded version and i use the function colors mod.

i have done the author part i just want last poster to show in color

you can kick me up the bum if ya want  ;)   sorry
Unknown User
2010-07-12 00:52:00
how about if we would like to edit say usersonline to display class colors rather than .css color

i had played with usersonline and getting template color

CODE:

Quote:
}//// USERS ONLINE ///////

begin_frame("" . usersonline . "", center);

$resew = mysql_query("SELECT id, username, class, donated, warned FROM users WHERE UNIX_TIMESTAMP(" . get_dt_num() . ") - UNIX_TIMESTAMP(last_access) < 86400 ORDER BY username");

while ($arr = mysql_fetch_assoc($resew))

{

if ($todayactive)

$todayactive .= ", ";

switch ($arr["class"])

{

case 8: // SYS:

$col = "#15CFCD";

break;

case 7: // ADMINISTRATORSYS:

$col = "#ff0000";

break;

case 6: // Administrator

$col = "teal";

break;

case 5: // Super Moderator

$col = "#3300CC";

break;

case 4: // Moderator

$col = "#006600";

break;

case 3: // VIP

$col = "#FFFF00";

break;

case 2: // Uploader

$col = "#33FF33";

break;

default: // User

$donator = $arr["donated"] > 0;

if ($CURUSER) {

$todayactive .= "<a href=account-details.php?id=" . $arr["id"] . ">" . $arr["username"] . "</a></a>";

} else {

$todayactive .= "<a href=account-details.php?id=" . $arr["id"] . ">" . $arr["username"] . "</a></a>";

}

if ($donator) {

$todayactive .= "<img src=\"images/star.gif\">";

}

$warned = $arr["warned"] == "yes";

if ($warned) {

$todayactive .= "<img src=\"images/warned.png\">";

}

$usersactivetoday++;

}

echo "<center><b><font color=black>Banned</font> |<font color=grey>Member</font> | <font color=purple>Power user</font> | <font color=green>VIP</font> | <font color=orange>Uploader</font> | <font color=#CAF619>seedbox Uploader</font> | <font color=blue>Moderator</font> | <font color=#39F7F7>Forum Moderator</font>  <br><font color=#33F619>Radio DJ</font> | <font color=pink>Sys-Op</font>| <font color=brown>Team Leader</font>| <font color=#ff0066>CO-OWNER</font> | <font color=RED>OWNER</font> <br><br></b></center>";

echo "<div align='left'>" . $todayactive . "</div>";

end_frame();

}

so others can use for own reference also cheers
Unknown User
2011-01-20 13:23:28
I'm having error

Fatal error: Cannot redeclare class_user() (previously declared in /home/public_html/backend/functions.php:779) in /home/public_html/backend/functions.php on line 779
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: 8
  • Members: 0
  • Guests online: 8
  • Comments: 3
  • Messages: 1,728