|
#1
|
||||
|
||||
Auto Promote/Demote user
these functions well auto promote and demote users By upload and ratio
Open include/cleanup.php add to before Code:
function getscrapedata($url) { Code:
/*Auto Prommote system By joeroberts To Use call to function in clean up You Must use a new call for each level you want to Promote autopromote(10,2,1.1,"Power User","user"); autpromote( $upload = user with upload equle or greater then $bite = Type of byte Meg Gig Tera $ratio = user with ratio equle or better then $new_level = New level to promote to $old_level = select from user in this level ) */ function autopromote($upload, $bite="1", $ratio, $new_level, $old_level){ global $db, $db_prefix; $mb = 1024*1024; $gb = 1024*1024*1024; $tb = 1024*1024*1024*1024; if ($bite == '1') $upload = $mb*$upload; elseif ($bite == '2') $upload = $gb*$upload; elseif ($bite == '3') $upload = $tb*$upload; else return; $res1 ="SELECT id FROM ".$db_prefix."_users WHERE can_do = '".$old_level."' AND active = 1 AND uploaded >= $upload AND uploaded / downloaded >= $ratio AND warned = '0'" ; $res =$db->sql_query($res1)or btsqlerror($res1); $prouser = array(); while ($arr = $db->sql_fetchrow($res)) { $prouser[] = $arr['id']; } $db->sql_freeresult($res); if(count($prouser) > 0) $db->sql_query("UPDATE ".$db_prefix."_users SET can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); } /*Auto Demotion system By joeroberts To Use call to function in clean up You Must use a new call for each level you want to demote autodemote(1.0, "user", "Power User"); autodemote( $ratio = user with ratio less then $new_level New Level for user $old_level Level From sich to demote from ) */ function autodemote($ratio, $new_level, $old_level){ global $db, $db_prefix; $res1 ="SELECT id FROM ".$db_prefix."_users WHERE can_do = '".$old_level."' AND active = 1 AND uploaded / downloaded < $ratio AND warned = '0'" ; $res =$db->sql_query($res1)or btsqlerror($res1); $prouser = array(); while ($arr = $db->sql_fetchrow($res)) { $prouser[] = $arr['id']; } $db->sql_freeresult($res); if(count($prouser) > 0) $db->sql_query("UPDATE ".$db_prefix."_users SET can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); } Code:
autoclean(); Code:
autopromote(10,2,1.1,"Power User","user"); autodemote(1.0, "user", "Power User");
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#2
|
||||
|
||||
With all respect, but it does not work for me.
|
#3
|
||||
|
||||
please give me example
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#4
|
||||
|
||||
I add this code before function getscrapedata
Code:
/*Auto Prommote system By joeroberts To Use call to function in clean up You Must use a new call for each level you want to Promote autopromote(10,2,1.1,"Power User","user"); autpromote( $upload = user with upload equle or greater then $bite = Type of byte Meg Gig Tera $ratio = user with ratio equle or better then $new_level = New level to promote to $old_level = select from user in this level ) */ function autopromote($upload, $bite="1", $ratio, $new_level, $old_level){ global $db, $db_prefix; $mb = 1024*1024; $gb = 1024*1024*1024; $tb = 1024*1024*1024*1024; if ($bite == '1') $upload = $mb*$upload; elseif ($bite == '2') $upload = $gb*$upload; elseif ($bite == '3') $upload = $tb*$upload; else return; $res1 ="SELECT id FROM ".$db_prefix."_users WHERE can_do = '".$old_level."' AND active = 1 AND uploaded >= $upload AND uploaded / downloaded >= $ratio AND warned = '0'" ; $res =$db->sql_query($res1)or btsqlerror($res1); $prouser = array(); while ($arr = $db->sql_fetchrow($res)) { $prouser[] = $arr['id']; } $db->sql_freeresult($res); if(count($prouser) > 0) $db->sql_query("UPDATE ".$db_prefix."_users SET can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); } /*Auto Demotion system By joeroberts To Use call to function in clean up You Must use a new call for each level you want to demote autodemote(1.0, "user", "Power User"); autodemote( $ratio = user with ratio less then $new_level New Level for user $old_level Level From sich to demote from ) */ function autodemote($ratio, $new_level, $old_level){ global $db, $db_prefix; $res1 ="SELECT id FROM ".$db_prefix."_users WHERE can_do = '".$old_level."' AND active = 1 AND uploaded / downloaded < $ratio AND warned = '0'" ; $res =$db->sql_query($res1)or btsqlerror($res1); $prouser = array(); while ($arr = $db->sql_fetchrow($res)) { $prouser[] = $arr['id']; } $db->sql_freeresult($res); if(count($prouser) > 0) $db->sql_query("UPDATE ".$db_prefix."_users SET can_do ='".$new_level."' WHERE id IN ( '".implode("','",$prouser)."')") or btsqlerror("UPDATE ".$db_prefix."_users SET can_do ='".$level."' WHERE id IN ( '".implode("','",$prouser)."')"); } Code:
autopromote(25,2,1.0,"power_user","user"); autodemote(0.9, "user", "power_user"); autopromote(100,2,2.0,"super_user","power_user"); autodemote(1.9, "power_user", "super_user"); autopromote(500,2,3.0,"elite_user","super_user"); autodemote(2.9, "super_user", "elite_user"); |
#5
|
||||
|
||||
what was your ratio?
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#6
|
||||
|
||||
More than 1.0, but upload was only 10 gb.
|
#7
|
||||
|
||||
well only demote By ratio as it takes into mind if you had the uploads to get to that level then that should not change
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#8
|
||||
|
||||
Why the code does not pay attention to upload, only the ratio? For what is the number of upload in this code?
Thx for answer, but autopromote and demote users would be very helpful. Is there any possibility to make it work properly?
__________________
|
#9
|
||||
|
||||
it pays attention in the promote part not the demote part it is easy to make it to so though give me a day as I got something else going now.
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent Do not ask me to make a mod for any other source Do not Ask me to setup your site. I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum My Current Demo is here http://demo.btmanager.org/ |
#10
|
||||
|
||||
Ok thx and btw great job ;)
Bump: Is it possible that the system sends a message to the user about the promotion or degradation, and to add an entry in the mod comment with the exact date when it was done?
__________________
|
Tags |
auto , promote or demote , user |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
TSSE 4.3/5.1 Cant promote a user to moderator | BEA | Template Shares | 5 | 30th November 2008 15:23 |
how change the normal user to power or admin user in ts TS Special Edition v.5.1 | theway | Template Shares | 2 | 27th September 2008 14:44 |
Auto promote uploaders | kristaps | Mods & Themes | 0 | 2nd September 2008 21:17 |
Demote uploader automatically | kp380lv | Mods & Themes | 0 | 29th August 2008 12:36 |
I can't promote users to adminstrator class!!!Help | kp380lv | Yuna Scatari Edition (YSE) | 4 | 4th August 2008 00:06 |