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
2012-07-07 14:06:52
find



echo    '</td><td style="font-size: 12px; padding-left: 5px"><a href="'.$site_config['SITEURL'].'/account-details.php?id='.$row['userid'].'" target="_parent"><b>'.$row['user'].':</b></a>&nbsp;&nbsp;'.nl2br(format_comment($row['message']));





replace with







echo    '</td><td style="font-size: 12px; padding-left: 5px"><a href="'.$site_config['SITEURL'].'/account-details.php?id='.$row['userid'].'" target="_parent"><b>'.class_user($row['user']).':</b></a>&nbsp;&nbsp;'.nl2br(format_comment($row['message']));
Unknown User
2012-07-07 20:45:04
TYVM !!!!!!!!!!!!!!!! cool
Unknown User
2012-07-07 20:57:14
"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 in torrents.php must insert the code ?
Unknown User
2012-07-15 13:11:30
if you mean the torrent page to show class of the uploader.

its in the /backend/functions.php

change this line  echo "<a href='account-details.php?id=$row[owner]'>$row[username]</a>";

to  echo "<a href='account-details.php?id=$row[owner]'>".class_user($row[username])."</a>";
Unknown User
2012-11-27 14:35:35
THANKS it works great on 2.08

what needs to be edited to show the colors on forums also...
2012-11-27 22:19:43
There are appx 9 places you can use the class_color code

here is my forums.php. I didnt change anything other than the class colors. Its otherwise the same as the svn. Backup your copy first please

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6270"]forums.php[/url]
forums.php
Download

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
2012-11-28 10:31:38
THANKS MicroMonkey - it helped

i simply changed all the

Quote:
$"???"[username]
in to

Quote:
".class_user($"???"[username])."

"???" = arr, user, a

THANKS
Unknown User
2012-12-16 07:01:48
thank you cooly
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