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
2011-02-12 18:04:23
you can add every where you whant like on index news

Unknown User
2011-11-27 19:48:48
"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

:)





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>";





in function,php where to add all these lines of user class colors
Unknown User
2011-11-28 08:58:42
to bottom of file before ?>
Unknown User
2011-12-04 06:50:23
"XIII, post: 76987":
to bottom of file before ?>

Thanks DJ :)
Unknown User
2011-12-09 01:42:13
Hi,





- Thanks for this cooly
Unknown User
2012-01-15 11:03:38
for those who have v2.08:

change:

$res = mysql_query($a);



for:



$res = SQL_Query_exec($a);
Unknown User
2012-01-16 10:47:01
the color didn't change for me i'm using v2.08 any help..?
Unknown User
2012-01-16 12:04:52
"Ravi.K, post: 78058":
it didn't change for me i'm using v2.08 any help..?

What didnt change?
Unknown User
2012-01-16 14:21:22
"riseandfall, post: 78065":
Heres an example of what u could do...


ALTER TABLE `groups` ADD `color` varchar(7) NOT NULL DEFAULT '#ff0000';

<?php

begin_block(T_("ONLINE_USERS"));



$expires = 600; // Cache time in seconds



if (($rows = $TTCache->Get("usersonline_block", $expires)) === false) {

$res = SQL_Query_exec("SELECT id, username, class, color FROM users LEFT JOIN groups ON users.class = groups.group_id WHERE enabled = 'yes' AND status = 'confirmed' AND privacy !='strong' AND UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(users.last_access) <= 900");



$rows = array();

while ($row = mysql_fetch_assoc($res)) {

$rows[] = $row;

}



$TTCache->Set("usersonline_block", $rows, $expires);

}



if (!$rows) {

echo T_("NO_USERS_ONLINE");

} else {

echo "<div id='uOnline' class='bMenu'><ul>\n";;

for ($i = 0, $cnt = count($rows), $n = $cnt - 1; $i < $cnt; $i++) {

$row = &$rows[$i];

echo "<li><a href='account-details.php?id=$row[id]'><font color='$row[color]'>$row[username]</font></a>".($i < $n ? ", " : "")."</li>\n";;

}

echo "</ul></div>\n";;

}



end_block();

?>


Hello,





thanks for the quick reply where do i need to add these things..??
Unknown User
2012-01-17 08:08:50
"riseandfall, post: 78069":
You do not add them anywhere... i was giving ideas to the developer on how to extend.


Okay but how can i change the colors of the classes. ??


Unknown User
2012-01-25 09:19:14
for those who have v2.08:

change



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>";

for




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/warn.png' alt='warned' border=0>";




add warn.png in images folder

warn.png
warn.png
Unknown User
2012-05-16 10:46:34
Hello :

How to add this for commenttable , to apply this mod when a user leave a comment and in account-details for

Quote:
<?php echo T_("USERNAME"); ?>: <?php echo htmlspecialchars($user["username"])?><br />

thank you
Unknown User
2012-05-16 20:02:57
^^

For account-details change





<?php echo T_("USERNAME"); ?>: <?php echo htmlspecialchars($user["username"])?><br />






to











<?php echo T_("USERNAME"); ?>: <?php echo class_user($user["username"])?><br />






For comments

open backend/functions.php



find







  $postername = htmlspecialchars($row["username"]);

if ($postername == "") {

$postername = T_("DELUSER");






change to







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

if ($postername == "") {

$postername = T_("DELUSER");






users online block



open blocks/useronline.php



change







  echo "<li><a href='account-details.php?id=$row[id]'>$row[username]</a>".($i < $n ? ", " : "")."</li>n";;








to





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



Unknown User
2012-05-17 13:38:06
thank you men, works :)
Unknown User
2012-07-07 00:49:43
"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>";





where must ad  ? : '.class_user($row['user']).'

In my shout I have this :

if ( ($CURUSER["edit_users"]=="yes") || ($CURUSER['username'] == $row['user']) ){
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: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728