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
Warned Level
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2010-04-20 12:33:24
Hi, I find this mod in TBDEV.

I tried to change the torrenttrader, but failed to do

Code:

Anyways, here we go

ALTER TABLE `users` ADD `timeswarned` int(10) NOT NULL default '0';
Now go to userdetails.php



and after




print("<tr><td class=rowhead>Class</td><td align=left>" . get_user_class_name($user["class"]) . "</td></tr>\n");







add this





//===Warned Progress Bar by TripleH @ TBDEV.NET

$UserTimesWarned = $user["timeswarned"];



switch($UserTimesWarned)

{

  case 0:

  $warnedbar = "<img src=pic/warn_0.png>";

  break;



  case 1:

  $warnedbar = "<img src=pic/warn_1.png> - <b>30%</b>";

  break;



  case 2:

  $warnedbar = "<img src=pic/warn_2.png> - <b>60%</b>";

  break;



  case 3:

  $warnedbar = "<img src=pic/warn_3.png - <b>90% - <font class=small>Be careful! One more warning and your account will be disabled</font></b>";

  break;



  case ($UserTimesWarned > 4):

  $warnedbar = "<img src=pic/warn_max.png> - <b>100% - Disabled</b>";

  break;

}



print("<tr><td class=rowhead>Warned level</td><td align=left>$warnedbar <font class=small>(".$UserTimesWarned." warning" . ($UserTimesWarned > 1 ? "s" : "") . ")</font></td></tr>\n");

//===Warned Progress Bar by TripleH @ TBDEV.NET







And now not understand





Now go over to modtask.php, and search for





$updateset[] = "warned = 'yes'





and replace it with





$updateset[] = "warned = 'yes', timeswarned = timeswarned+1";





where modtask on torrenttrader



Now, in order to auto disable the account when a user gets the 4th warning, add this part into cleanup.php





//=== Warned Level Mod - TripleH @ TBDev.Net (Thanks arcticwolf44 for this piece of code)

$res = mysql_query("SELECT id, modcomment FROM users WHERE timeswarned = 4 AND enabled = 'yes'") or sqlerr(__FILE__, __LINE__);

if (mysql_num_rows($res) > 0)

{

$dt = sqlesc(get_date_time());

while ($arr = mysql_fetch_assoc($res))

{



$modcomment = htmlspecialchars($arr["modcomment"]);

$modcomment = gmdate("Y-m-d") . " - Auto Disabled for having over 3 Warning by -AutoSystem.\n". $modcomment;

$modcom = sqlesc($modcomment);



mysql_query("UPDATE users SET enabled='no', modcomment = $modcom WHERE id = $arr[id]") or sqlerr(__FILE__, __LINE__);

}

}

//===





And that's all

NOTE: In short time I will add the script which auto disables the user, it's basically just a condition which checks if the user has more than 3 warnings -> set enabled = 'no';



[url="http://www.tbdev.net/index.php?app=core&module=attach&section=attach&attach_id=6699"]Images[/url]

Mod Note: Please give credit to original author.
Unknown User
2010-04-20 19:10:16
in admin-modtasks.php find:

$ret = mysql_query("UPDATE users SET warned='yes' WHERE id='$userid'");
and replace with this:


$ret = mysql_query("UPDATE users SET warned='yes', timeswarned = timeswarned+1 WHERE id='$userid'");



Not tested.
Unknown User
2010-04-21 02:04:56
above does work:)

also I added an way for the staff to change the number of warning if needed:

in top of admin-modtasks.php near the rest of the $_POST defines add:

$timeswarned = $_POST["timeswarned"];
then find , warned='$warned'   and add after


, timeswarned = $timeswarned





Then in account-details.php

find:

	print("<tr><td>Warned: </td><td align=left><input name=warned value=yes type=radio" . ($warned ? " checked" : "") . ">Yes <input name=warned value=no type=radio" . (!$warned ? " checked" : "") . ">No</td></tr>\n");



and after add:



print("<tr><td>Times Warned</td><td align=left><input type=timeswarned size=8 name=timeswarned value=\"$user[timeswarned]\"></tr>\n");



Should be it.
Unknown User
2010-04-21 12:45:05
Thx. ArcticWolf
Unknown User
2010-06-23 11:05:47
instead of adding an extra field to users.... why dont u just make a simple query to count the warnings....

like

$query = mysql_query("SELECT COUNT(*) FROM `warnings` WHERE `userid` = $user[id]");

$row = mysql_fetch_array($query));


then use switch ($row[0])
Unknown User
2010-06-24 16:40:46
could somebody do this to show  the member  the warned images in they're account profile/account.php please, so they themselves can see the warned level they're on , after all its worded like that, many thanks   ;)

Also , would it be possible to incorporate the already installed warned feature , at the moment i got members on warnings and still the times warned says 0  :blink:  many thanks in advance.
Unknown User
2010-06-24 17:21:29
First uninstall what ever he has told you to do up above then open account-details.php

find

Warnings: <?=htmlspecialchars($user["warned"])?><BR>
Add After




Warning Level: <?=get_user_warned_level($id)?>





go to backend functions and add this to bottom





function get_user_warned_level($id){

$res = mysql_query("SELECT COUNT(*) FROM warnings WHERE userid=$id") or die(mysql_error());

$arr = mysql_fetch_row($res);

$warnings = $arr[0];



switch($warnings){

case 0:

  $warnedbar = "<img src='images/warn_0.png'>";

  break;



  case 1:

  $warnedbar = "<img src=images/warn_1.png> - <b>30%</b>";

  break;



  case 2:

  $warnedbar = "<img src=images/warn_2.png> - <b>60%</b>";

  break;



  case 3:

  $warnedbar = "<img src=images/warn_3.png - <b>90% - <font class=small>Be careful! One more warning and your account will be disabled</font></b>";

  break;



  case 4:

  $warnedbar = "<img src=images/warn_max.png> - <b>100% - Disabled</b>";

  break;

  }

 

  return $warnedbar;

}



there is no need for the excess code from tbdev....
Unknown User
2010-06-24 23:44:45
Dj thats exactly what i wanted bud ....BUT, is there something to add in clean up , cos a member i removed a warning from still shows 30% image ?
Unknown User
2010-06-25 00:15:01
nope what i posted counts the warnings from warnings table and shows a pic on how many warnings he has had it doesnt control giving or taking away any.... make sure u reverted to ure old code if u get stuck grab a fresh copy of tt and compare
Unknown User
2010-06-25 08:43:31
thanks for quick reply bud , seems after main clean up its working great ....Thanks again.
Unknown User
2010-06-25 09:13:56
no problem... this can be moved to completed now...!
Unknown User
2010-06-25 23:58:56
yes totally bud .......:blink:
Unknown User
2010-07-19 19:45:57
hi guys

im interested in this mod but its possible to resume the mod in one shot? thanks (im french my english is basic sorry:()
Unknown User
2010-07-19 21:29:45
read the bit Jun 24 2010, 06:21 PM and follow the instruction from there
Unknown User
2010-08-18 17:28:02
"Mush, post: 64055":
could somebody do this to show  the member  the warned images in they're account profile/account.php please, so they themselves can see the warned level they're on , after all its worded like that, many thanks   ;)


Would be great if they could see in their own account, can anybody do this?
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