you can add every where you whant like on index news
"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....
Now all you need to do is for any "username" code for example $row['user'] in shoutbox would now befunction 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>");
}
'.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>";
"XIII, post: 76987":to bottom of file before ?>
$res = mysql_query($a);
for:
$res = SQL_Query_exec($a);
"Ravi.K, post: 78058":it didn't change for me i'm using v2.08 any help..?
"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();
?>
"riseandfall, post: 78069":You do not add them anywhere... i was giving ideas to the developer on how to extend.
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>";
Quote:<?php echo T_("USERNAME"); ?>: <?php echo htmlspecialchars($user["username"])?><br />
<?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";;
"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....
Now all you need to do is for any "username" code for example $row['user'] in shoutbox would now befunction 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>");
}
'.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>";
No users online
Torrents
Members
Online