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
New Invite Tree for 2.08
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2012-12-26 08:46:38
Create a new file invitetree.php and upload it in your root:

[url="https://www.torrenttrader.org/topic/12259-class-colors-function"]https://www.torrenttrader.org/topic/17452-class-colors-function-for-208[/url]

If you have not installed this mod, simply replace:



<?php

require_once("backend/functions.php");

dbconn(true);

loggedinonly();



$id = $_GET["id"];

if (!is_valid_id($id))

$id = $CURUSER["id"];



$res = SQL_Query_exec("SELECT * FROM users WHERE status = 'confirmed' AND invited_by = $id ORDER BY username");

$num = mysql_num_rows($res);



stdhead("Invite Tree for ".$id."");



$invitees = number_format(get_row_count("users", "WHERE status = 'confirmed' && invited_by = $id"));

if ($invitees == 0)

show_error_msg("Nothing to see here!", "<div style='margin-top:10px; margin-bottom:10px' align='center'><font size=2>This member has no invitees</font></div>

<div style='margin-bottom:10px' align='center'>[<a href=account-details.php?id=$id>Go Back to User Profile</a>]</div>");



if ($id != $CURUSER["id"]) {

begin_frame("Invite Tree for [<a href=account-details.php?id=$id>".$id."</a>]");

} else {

begin_frame("You have [$invitees] invitees ".class_user($CURUSER["username"])."");

}

print("<br />"); //one small space here!



print("<table class=table_table border=1 cellspacing=0 cellpadding=5 align=center>n");

print("<tr>

<td class=table_head><b>Invited&nbsp;Members</b></td>

<td class=table_head><b>Class</b></td>

<td class=table_head align=center><b>Registered</b></td>

<td class=table_head align=center><b>Last&nbsp;access</b></td>

<td class=table_head align=center><b>Downloaded</b></td>

<td class=table_head align=center><b>Uploaded<b></td>

<td class=table_head align=center><b>Ratio</b></td>

<td class=table_head align=center><b>Warned</b></td>

</tr>n");



for ($i = 1; $i <= $num; $i++) {



$arr = mysql_fetch_assoc($res);



if ($arr["invited_by"] != $CURUSER['id'] && $CURUSER["class"] < 5) {

print("<tr><td class=table_col1 align=center colspan=8><font color=red><b>Access Denied</b>.</font>&nbsp; You don't have permission to view the invitees of other users!</td></tr>n");

print("</table>n");

print("<br />"); //one small space here!

end_frame();

stdfoot();

}



if ($arr['added'] == '0000-00-00 00:00:00')

$arr['added'] = '---';



if ($arr['last_access'] == '0000-00-00 00:00:00')

$arr['last_access'] = '---';



if($arr["downloaded"] != 0){

$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 2);

} else {

$ratio="---";

}

$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";



if ($arr["warned"] !== "yes"){

$warned = "<font color=limegreen><b>No</b></font>";

} else {

$warned = "<font color=red><b>Yes</b></font>";

}



$class=get_user_class_name($arr["class"]);

$added = substr($arr['added'],0,10);

$last_access = substr($arr['last_access'],0,10);

$downloaded = mksize($arr["downloaded"]);

$uploaded = mksize($arr["uploaded"]);



print("<tr><td class=table_col1 align=left><a href=account-details.php?id=$arr[id]><b>".class_user($arr[username])."</b></a></td>

<td class=table_col2 align=left>$class</td>

<td class=table_col1 align=center>$added</td>

<td class=table_col2 class=table_col1 align=center>$last_access</td>

<td class=table_col1 align=center><font color=orangered>$downloaded</font></td>

<td class=table_col2 align=center><font color=limegreen>$uploaded</font></td>

<td class=table_col1 align=center>$ratio</td>

<td class=table_col2 align=center>$warned</td>

</tr>n");

}

print("</table>n");



if ($arr["invited_by"] != $CURUSER['id']) {

print("<div style='margin-top:10px' align='center'>[<a href=account-details.php?id=$id><b>Go Back to User Profile</b></a>]</div>");

}

print("<br />"); //one small space here!



end_frame();

stdfoot();

?>

Replace the invite_block.php code with this one:




<?php

if (($site_config["INVITEONLY"] || $site_config["ENABLEINVITES"]) && $CURUSER) {

$invites = $CURUSER["invites"];

begin_block(T_("INVITES"));

?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td align="center">

<?php printf(P_("YOU_HAVE_INVITES", $invites), $invites); ?>

</td>

</tr>

<?php if ($invites > 0 ){?>

<tr>

<td align="center">

<a href="invite.php"><?php echo T_("SEND_AN_INVITE"); ?></a>

</td>

</tr>

<?php } ?>

<?php if ($CURUSER["invitees"] > 0 ){ ?>

<tr>

<td align="center">

<a href='invitetree.php'>Invite Tree</a>

</td>

</tr>

<?php } ?>

</table>

<?php

end_block();

}

?>






In account-details.php replace this code:





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






With this one:





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

<?php if ($CURUSER["class"] >= 5 && $CURUSER["class"] > $user["class"]) { ?>[<a href="invitetree.php?id=<?php echo $user["id"]?>">Invite Tree</a>]<?php } ?><br />






I use class colors function:

".class_user($row["username"])."

with:

".$row["username"]."







invitetree.png
invitetree.png
invitetree2.png
invitetree2.png
invitetree3.png
invitetree3.png
invitetree4.png
invitetree4.png
Unknown User
2012-12-26 09:37:47
Work just fine but one small problem.

Other users can see other users threes.

So my link is:

my.site/invitetree.php?id=545 (me)

but if i change a adress to:

my.site/invitetree.php?id=600 (other user)

then i see hes invites to.

I think this is not OK.

You may not see other members invites.

And one nice update for that is if ratio under 1 be red and ower 1 is green.

Thanks for your help and sorry for my bad english  :D .
Unknown User
2012-12-26 11:49:49
Thanks for your observation savi, I update the first post.

If you do not like the ratio colors, search in backend/functions.php this function:



function get_ratio_color($ratio) {

   if ($ratio < 0.1) return "#ff0000";

   if ($ratio < 0.2) return "#ee0000";

   if ($ratio < 0.3) return "#dd0000";

   if ($ratio < 0.4) return "#cc0000";

   if ($ratio < 0.5) return "#bb0000";

   if ($ratio < 0.6) return "#aa0000";

   if ($ratio < 0.7) return "#990000";

   if ($ratio < 0.8) return "#880000";

   if ($ratio < 0.9) return "#770000";

   if ($ratio < 1) return "#660000";

   return "#000000";

}


and replaces the color codes with other ones on your taste :P
2012-12-26 14:28:09
Thanks You BigMax1  :D

merci encore, ca fonctionne tres bien!

***********************************************

thank you again, it works very well!
Unknown User
2012-12-26 14:29:03
Problem in that, this dont show colors at all. They all the same.



EDIT:

Seems you change 1st post, i try this changes.

Thanks.
Unknown User
2012-12-26 15:00:25
Other users thing now OK, they see only own threes, but moderators and sysops dont see now users threes to  :D .

And for ratio colors:

find:



if($arr["downloaded"] != 0){

$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);

} else {

$ratio="---";

}

replace with:




if ($arr["downloaded"] > 0)

{

$ratio = number_format($arr["uploaded"] / $arr["downloaded"], 2);

$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";

}

else

if ($arr["uploaded"] > 0)

$ratio = "Inf.";

else

$ratio = "---";




Unknown User
2012-12-26 15:18:35
savi, you have "get_ratio_color" function in "backend/function.php"? maybe you use an old version of TT...

If you do not have it, copy the original function I've posted above, in the bottom of functions.php, before: ?>

I do not know what else it could be, to me it works perfectly.

And staff members must see in the user profile that are the invited members, not in the "Invite Tree"...
Unknown User
2012-12-26 15:27:28
Sorry about that then yes. I use 2.05. But i get colors to now  :P .

Only fix that sysop and moderators thing. So they see all users threes.

Then its perfect!
Unknown User
2012-12-26 15:54:52
OK, replace:

if ($arr["invited_by"] != $CURUSER['id']) {

with:

if ($arr["invited_by"] != $CURUSER['id'] && $CURUSER["class"] < 5) {
Unknown User
2012-12-26 16:01:47
Yesh, perfect  :) !

Thank you.
Unknown User
2012-12-26 23:32:05
THANK YOU!
Unknown User
2012-12-29 05:46:00
it works but the only way I can see it if I type the whole address in the Browser it don't show in account details.
Unknown User
2012-12-29 06:23:03
Initially this mod it was designed just to see your invited users, but I've changed it so that the staff to see and the invitees from other members.

I updated the first post.
Unknown User
2012-12-29 10:28:01
thank you very much
Unknown User
2013-01-13 21:05:45
I think it's better to use



$CURUSER["control_panel"] == "yes"



for those who have more than 7 class
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: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728