Bravo List

Bravo List (http://www.bvlist.com/index.php)
-   TBDev (http://www.bvlist.com/forumdisplay.php?f=20)
-   -   User Color in browse (http://www.bvlist.com/showthread.php?t=11870)

elvira 29th November 2018 09:10

User Color in browse
 
Hi something not working so I need any idea

I put this in global.php

PHP Code:

  function get_user_class_color($class)
{
      switch (
$class)
  {
    case 
UC_USER: return "black";

    case 
UC_POWER_USER: return "#f9a200";

    case 
UC_VIP: return "#009F00";

    case 
UC_UPLOADER: return "#6464FF";

    case 
UC_MODERATOR: return "#ff5151";

    case 
UC_ADMINISTRATOR: return "#B000B0";

    case 
UC_SYSOP: return "#2587A7";
    
    case 
UC_STAFFLEADER: return "darkred";

    }
    return 
"";



and add in fuctions.php


PHP Code:

print("<td align=center>" . (isset($row["username"]) ? ("<a href=userdetails.php?id=" $row["owner"] . "><font color=\"#" get_user_class_color($row["class"]) . "\">" htmlspecialchars($row["username"]) . "</font></a>") : "<i>(unknown)</i>") . "</td>\n"); 


and still not work, what I missed, thanks for help

darkalchemy 29th November 2018 09:15

Just a quick glance, you are doubling the '#' sign.

elvira 29th November 2018 09:31

where you see, its only one

darkalchemy 29th November 2018 09:38

case UC_USER: return "#f9a950";

case UC_POWER_USER: return "#f9a200";

case UC_VIP: return "#009F00";

case UC_UPLOADER: return "#6464FF";

case UC_MODERATOR: return "#ff5151";

case UC_ADMINISTRATOR: return "#B000B0";

case UC_SYSOP: return "#2587A7";

case UC_STAFFLEADER: return "#0F6CEE";

Looks like 2 to me.

elvira 29th November 2018 09:46

ok I change this line and not work

PHP Code:

print("<td align=center>" . (isset($row["username"]) ? ("<a href=userdetails.php?id=" $row["owner"] . "><b><font color='" get_user_class_color($row["class"]) . "'> " htmlspecialchars($row['username']) . "</font></b></a>") : "<i>(unknown)</i>") . "</td>\n"); 


darkalchemy 29th November 2018 09:53

You're going to have to be more specific, what doesn't work? What is the exact error, etc?

elvira 29th November 2018 09:58

on browse got same color users not different

darkalchemy 29th November 2018 10:05

Where is row['class'] coming from? Is it from a join to users? Is the query correct? Are the results correct? What color is displayed? What class does that match?

elvira 29th November 2018 10:14

can we go step by step...

Test is User color black

SlaTkis is StaffLeader color black must be darkred

http://shrani.si/f/1r/XI/1ZqmnIci/12.png

darkalchemy 29th November 2018 11:39

I have to guess, because you have not answered the previous questions.

It appears that your query, more specifically your join is flawed. If you look at your error log, you may see that index 'class' does not exist. If you do, simple fix, add the proper join
Code:

LEFT JOIN users ON torrents.owner = users.id
and be sure that you select the class in the query.

But without more information, I am only guessing.


All times are GMT +2. The time now is 14:21.

Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2019, vBulletin Solutions Inc.