Members   Search      Help    Register    Login    Home
Home » Support Forums for PMBT 2.X » General Help for 2.X » group colors(site wdie)
group colors [message #4433] Sun, 11 July 2010 18:57 Go to next message
Daffy is currently offline Daffy  France
Messages: 359
Registered: October 2009
Location: uk
Releaser

when a user makes comment on a torrent. there level color isnt there. wot do i put here to show users color
define("_btcommheader","By <a href=\"user.php?op=profile&id=**uid**\" target=\"_top\">**user**</a> On **time**"); 



also in torrent details. Uploaded By, dosnt show users group color.

iv tried this but dosnt seem to show up any colors

echo "<tr><td><p>"._btuppedby."</p></td><td><p>";
switch ($torrent["ownertype"]) {
        case 0: {
                echo "<a href=\"user.php?op=profile&amp;id=".$torrent["owner"]."\"><font color=\"".getusercolor($row["can_do"])."\">".htmlspecialchars($torrent["ownername"])."</a></font>";
                if ($user->admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[".htmlspecialchars($torrent["user_host"])."]";
                break;
        }
        case 1: {
                if ($user->moderator) echo "<a href=\"user.php?op=profile&amp;id=".$torrent["owner"]."\"><font color=\"".getusercolor($row["can_do"])."\">".htmlspecialchars($torrent["ownername"])."</a></font>";
                else echo "<i>"._btunknown."</i>";
                if ($user->admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[".htmlspecialchars($torrent["user_host"])."]";
        }
        case 2: {
                if ($user->admin) echo "[".htmlspecialchars($torrent["user_host"])."]";
                else echo "<i>"._btunknown."</i>";
        }
}


[Updated on: Sun, 11 July 2010 19:03]

Report message to a moderator

Re: group colors [message #4434 is a reply to message #4433] Sun, 11 July 2010 19:23 Go to previous messageGo to next message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
for comments
in ajax.php find
#Read Comments
$id = $_GET['torrent'];
$password = $_GET["password"];
                if (!isset($id) OR !is_numeric($id) OR $id < 1) error(_bterridnotset);
                $password = urldecode($password);
                $sql = "SELECT password FROM ".$db_prefix."_torrents WHERE id = '".$id."' AND (password IS NULL OR password = '".$password."') LIMIT 1;";
                $res = $db->sql_query($sql);
                if ($db->sql_numrows($res) < 1) die(); //Password is wrong or not set
                $db->sql_freeresult($res);
                $sql = "SELECT C.*, U.id as uid, U.username, U.name, IF(U.name IS NULL, U.username, U.name) as user_name, U.avatar as user_avatar FROM ".$db_prefix."_comments C LEFT JOIN ".$db_prefix."_users U ON C.user = U.id WHERE C.torrent ='".$id."' ORDER BY added ASC;";
                $res = $db->sql_query($sql) or btsqlerror($sql);
                if ($db->sql_numrows($res) < 1) {
                        echo "<h3 align=\"center\" class=\"title\">"._btnocommentsyet."</h3>";
                } else while ($comment = $db->sql_fetchrow($res)) {
                        echo "<a name=\"comm".$comment["id"]."\"></a><table width=\"100%\" class=\"main\">";
                        echo "<thead>\n<tr><td class=\"colhead\">";
                        $search = Array("**user**","**uid**","**time**");
                        $replace = Array(htmlspecialchars($comment["user_name"]),$comment["uid"],formatTimestamp($comment["added"]));

and change it to
#Read Comments
$id = $_GET['torrent'];
$password = $_GET["password"];
                if (!isset($id) OR !is_numeric($id) OR $id < 1) error(_bterridnotset);
                $password = urldecode($password);
                $sql = "SELECT password FROM ".$db_prefix."_torrents WHERE id = '".$id."' AND (password IS NULL OR password = '".$password."') LIMIT 1;";
                $res = $db->sql_query($sql);
                if ($db->sql_numrows($res) < 1) die(); //Password is wrong or not set
                $db->sql_freeresult($res);
                $sql = "SELECT C.*, U.id as uid, U.can_do as can_do, U.username, U.name, IF(U.name IS NULL, U.username, U.name) as user_name, U.avatar as user_avatar FROM ".$db_prefix."_comments C LEFT JOIN ".$db_prefix."_users U ON C.user = U.id WHERE C.torrent ='".$id."' ORDER BY added ASC;";
                $res = $db->sql_query($sql) or btsqlerror($sql);
                if ($db->sql_numrows($res) < 1) {
                        echo "<h3 align=\"center\" class=\"title\">"._btnocommentsyet."</h3>";
                } else while ($comment = $db->sql_fetchrow($res)) {
                        echo "<a name=\"comm".$comment["id"]."\"></a><table width=\"100%\" class=\"main\">";
                        echo "<thead>\n<tr><td class=\"colhead\">";
                        $search = Array("**user**","**uid**","**time**");
                        $replace = Array("<font color=\"".getusercolor($comment["can_do"])."\">".htmlspecialchars($comment["user_name"])."</font>",$comment["uid"],formatTimestamp($comment["added"]));


http://a.imageshack.us/img831/5562/mybikes.png
Re: group colors [message #4435 is a reply to message #4434] Sun, 11 July 2010 19:34 Go to previous messageGo to next message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
for torrent owner fine
switch ($torrent["ownertype"]) {
        case 0: {
                echo "<a href=\"user.php?op=profile&amp;id=".$torrent["owner"]."\">".htmlspecialchars($torrent["ownername"])."</a>";
                if ($user->admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[".htmlspecialchars($torrent["user_host"])."]";
                break;
        }
        case 1: {
                if ($user->moderator) echo "<a href=\"user.php?op=profile&amp;id=".$torrent["owner"]."\">".htmlspecialchars($torrent["ownername"])."</a>";
                else echo "<i>"._btunknown."</i>";
                if ($user->admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[".htmlspecialchars($torrent["user_host"])."]";
        }
        case 2: {
                if ($user->admin) echo "[".htmlspecialchars($torrent["user_host"])."]";
                else echo "<i>"._btunknown."</i>";
        }
}

and make it
switch ($torrent["ownertype"]) {
        case 0: {
                echo "<a href=\"user.php?op=profile&amp;id=".$torrent["owner"]."\"><font color=\"".getusercolor(getlevel_name($torrent["owner"]))."\">".htmlspecialchars($torrent["ownername"])."</font></a>";
                if ($user->admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[".htmlspecialchars($torrent["user_host"])."]";
                break;
        }
        case 1: {
                if ($user->moderator) echo "<a href=\"user.php?op=profile&amp;id=".$torrent["owner"]."\"><font color=\"".getusercolor(getlevel_name($torrent["owner"]))."\">".htmlspecialchars($torrent["ownername"])."</font></a>";
                else echo "<i>"._btunknown."</i>";
                if ($user->admin) echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[".htmlspecialchars($torrent["user_host"])."]";
        }
        case 2: {
                if ($user->admin) echo "[".htmlspecialchars($torrent["user_host"])."]";
                else echo "<i>"._btunknown."</i>";
        }
}

there is 2 cases of this one in ajax.php


http://a.imageshack.us/img831/5562/mybikes.png
Re: group colors [message #4436 is a reply to message #4434] Sun, 11 July 2010 19:35 Go to previous messageGo to next message
Daffy is currently offline Daffy  France
Messages: 359
Registered: October 2009
Location: uk
Releaser

you meant frame.php didnt you lol.

this is my part incase anyone wants to change there own.

case "commentlist": {
                if (!isset($id) OR !is_numeric($id) OR $id < 1) error(_bterridnotset);
                $password = urldecode($password);
                $sql = "SELECT password FROM ".$db_prefix."_torrents WHERE id = '".$id."' AND (password IS NULL OR password = '".$password."') LIMIT 1;";
                $res = $db->sql_query($sql);
                if ($db->sql_numrows($res) < 1) die(); //Password is wrong or not set
                $db->sql_freeresult($res);
                $sql = "SELECT C.*, U.id as uid, U.can_do as can_do, U.username, U.name, IF(U.name IS NULL, U.username, U.name) as user_name, U.avatar as user_avatar FROM ".$db_prefix."_comments C LEFT JOIN ".$db_prefix."_users U ON C.user = U.id WHERE C.torrent ='".$id."' ORDER BY added ASC;";
                $res = $db->sql_query($sql) or btsqlerror($sql);
                if ($db->sql_numrows($res) < 1) {
                        echo "<h3 align=\"center\" class=\"title\"><u>Be the first to comment.</u></h3>";
                } else while ($comment = $db->sql_fetchrow($res)) {
                        echo "<a name=\"comm".$comment["id"]."\"></a><table width=\"100%\" class=\"main\">";
                        echo "<thead>\n<tr><td class=\"colhead\">";
                        $search = Array("**user**","**uid**","**time**");
                        $replace = Array("<font color=\"".getusercolor($comment["can_do"])."\">".htmlspecialchars($comment["user_name"])."</font>",$comment["uid"],formatTimestamp($comment["added"]));
                        echo str_replace($search,$replace,_btcommheader);
                        echo "</td>\n</tr>\n</thead>\n";
                        echo "<tbody>\n<tr><td>";
                        echo "<table width=\"100%\">\n</tr>\n<td width=\"100\">";
                        if ($comment["user_avatar"] != "blank.gif") echo "<img src=\"avatars/".$comment["user_avatar"]."\" alt=\"".str_replace("**user**",($comment["name"] == "") ? $comment["username"]:$comment["name"],_btalt_avatar)."\" width=\"70\" border=\"0\">";
                        else echo pic("noavatar.png");
                        echo "</td>\n<td>";
						$body = stripslashes(format_comment($comment["text"]));
                        parse_smiles($body);
                        if ($user->admin OR $user->id == $comment["user"]) echo "<div align=\"right\"><a href=\"comment.php?op=delete&id=".$id."&cid=".$comment["id"]."\" target=\"_top\">".pic("drop.gif")."</a></div>";
                        echo "<div align=\"justify\">".$body."</div>";
                        echo "</td>\n</tr>\n</table>\n";
						echo "<tr><td><HR></td></tr>\n";												
                        echo "</td>\n</tr>\n</tbody>\n";
                        echo "</table>";
                }
                break;
        }


Re: group colors [message #4437 is a reply to message #4436] Sun, 11 July 2010 19:40 Go to previous messageGo to next message
Daffy is currently offline Daffy  France
Messages: 359
Registered: October 2009
Location: uk
Releaser

Fatal error: Call to undefined function getlevel_name() in ajax.php on line 1670

Re: group colors [message #4438 is a reply to message #4437] Sun, 11 July 2010 21:28 Go to previous messageGo to next message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
first no I ment in ajax.php
and second put this new function in include/functions.php
function getlevel_name($userid){
        global $db, $db_prefix;
			$sql = "SELECT `can_do` FROM ".$db_prefix."_users WHERE `id` = '".$userid."';";
			$res = $db->sql_query($sql) or btsqlerror($sql);
            if ($db->sql_numrows($res) == 0) return "guest";
			else{
			$row = $db->sql_fetchrow($res);
		    return $row['can_do'];
			}
}


http://a.imageshack.us/img831/5562/mybikes.png
Re: group colors [message #4452 is a reply to message #4438] Mon, 12 July 2010 18:49 Go to previous messageGo to next message
Daffy is currently offline Daffy  France
Messages: 359
Registered: October 2009
Location: uk
Releaser

ok. well in ajax.php i dont have that code. that code you mentioned is in my frame.php il add the above to my functions.php, i did add it to my frame.php and it works lol.

Re: group colors [message #4470 is a reply to message #4452] Thu, 15 July 2010 20:12 Go to previous message
joeroberts is currently offline joeroberts  United States
Messages: 1971
Registered: June 2006
Location: U.S.A
Releaser
Da HacKer
OK well mine dose so I may be looking at Mine :s Very Happy

http://a.imageshack.us/img831/5562/mybikes.png
Previous Topic:What controls the 'User Menu'
Next Topic:eror download!!
Goto Forum:
  


Current Time: Wed Feb 08 22:52:54 GMT 2012

Total time taken to generate the page: 0.00754 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software