This mod adds 11 groups to v3 and some of them are automated, it includes the class colour function mod by bigmax.
The only issue i had so far is members who signup are class 2 but members who signup using invites are class 1, its designed for people with ratio below 1 to be restricted so ideally all new members should be class 2
// Owner
// Admin
// Super Mod
// Moderator
// VIP
// Uploader
// Addict - if uploaded 250GB more than download
// Pro User - if uploaded 150GB more than download
// Power User - if uploaded 50GB more than download
// Member - this is new base class with minum ratio of 1
// Leecher - any user with ratio below 0.9 is demoted here and can not download
SQL
Change all normal users to class 2 & update owner class
In functions before the last ?> ( if colour function mod already installed just update)
In config add ( if colour function mod already installed just update)
in account_signup.php find ( now new members are class 2 )
change to
In cleanup.php find
Add before
[color=rgb(251, 160, 38)]I also have automation & demotion for uploaders from TTfr just add after the code above (cleanup.php)[/color]
[color=rgb(251, 160, 38)]In footer.php add links if you wish find[/color]
before
The only issue i had so far is members who signup are class 2 but members who signup using invites are class 1, its designed for people with ratio below 1 to be restricted so ideally all new members should be class 2
// Owner
// Admin
// Super Mod
// Moderator
// VIP
// Uploader
// Addict - if uploaded 250GB more than download
// Pro User - if uploaded 150GB more than download
// Power User - if uploaded 50GB more than download
// Member - this is new base class with minum ratio of 1
// Leecher - any user with ratio below 0.9 is demoted here and can not download
SQL
Change all normal users to class 2 & update owner class
UPDATE users SET class = '2' WHERE class = '1'
UPDATE users SET class = '11' WHERE class = '7'
DROP TABLE IF EXISTS `groups`;
CREATE TABLE `groups` (
`group_id` int(10) NOT NULL AUTO_INCREMENT,
`level` varchar(50) NOT NULL DEFAULT '',
`view_torrents` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_torrents` enum('yes','no') NOT NULL DEFAULT 'no',
`delete_torrents` enum('yes','no') NOT NULL DEFAULT 'no',
`view_users` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_users` enum('yes','no') NOT NULL DEFAULT 'no',
`delete_users` enum('yes','no') NOT NULL DEFAULT 'no',
`view_news` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_news` enum('yes','no') NOT NULL DEFAULT 'no',
`delete_news` enum('yes','no') NOT NULL DEFAULT 'no',
`can_upload` enum('yes','no') NOT NULL DEFAULT 'no',
`can_download` enum('yes','no') NOT NULL DEFAULT 'yes',
`view_forum` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_forum` enum('yes','no') NOT NULL DEFAULT 'yes',
`delete_forum` enum('yes','no') NOT NULL DEFAULT 'no',
`control_panel` enum('yes','no') NOT NULL DEFAULT 'no',
`staff_page` enum('yes','no') NOT NULL DEFAULT 'no',
`staff_public` enum('yes','no') NOT NULL DEFAULT 'no',
`staff_sort` tinyint(3) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `base` (`group_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
INSERT INTO `groups` (`group_id`, `level`, `view_torrents`, `edit_torrents`, `delete_torrents`, `view_users`, `edit_users`, `delete_users`, `view_news`, `edit_news`, `delete_news`, `can_upload`, `can_download`, `view_forum`, `edit_forum`, `delete_forum`, `control_panel`, `staff_page`, `staff_public`, `staff_sort`) VALUES
(1, 'Leecher', 'yes', 'no', 'no', 'no', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'yes', 'no', 'no', 'no', 'no', 'no', 1),
(2, 'Member', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 2),
(3, 'Power User', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 3),
(4, 'Pro User', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 4),
(5, 'Addict', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'no', 5),
(6, 'Uploader', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'yes', 6),
(7, 'VIP', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'yes', 'no', 'no', 'no', 'no', 'yes', 7),
(8, 'Moderator', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'yes', 'no', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 8),
(9, 'Super Mod', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'no', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 9),
(10, 'Admin', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 10),
(11, 'Owner', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 'yes', 11);
In functions before the last ?> ( if colour function mod already installed just update)
////////////////////modcolor
//start class colors function
function class_user($name) {
global $site_config;
$a ="SELECT class, donated, warned, enabled FROM `users` WHERE username ='".$name."'";
$res = SQL_Query_exec($a);
$classy = @mysqli_fetch_row($res);
switch ($classy[0]) {
case 11: // Owner
$col = "".$site_config["owner_color"]."";
break;
case 10: // Admin
$col = "".$site_config["admin_color"]."";
break;
case 9: // Super Mod
$col = "".$site_config["super_mod_color"]."";
break;
case 8: // Moderator
$col = "".$site_config["moderator_color"]."";
break;
case 7: // VIP
$col = "".$site_config["vip_color"]."";
break;
case 6: // Uploader
$col = "".$site_config["uploader_color"]."";
break;
case 5: // Addict
$col = "".$site_config["addict_color"]."";
break;
case 4: // Pro User
$col = "".$site_config["pro_user_color"]."";
break;
case 3: // Power User
$col = "".$site_config["power_user_color"]."";
break;
case 2: // Member
$col = "".$site_config["member_color"]."";
break;
case 1: // Leecher
$col = "".$site_config["leecher_color"]."";
}if($classy[1]>0){
$star="<img src='".$site_config[SITEURL]."/images/star.png' alt='donated' border='0'>";
}else{ $star="";}
if($classy[2]=="yes"){
$warn="<img src='".$site_config[SITEURL]."/images/warned.png' alt='warned' border=0>";
}else{ $warn=""; }
if($classy[3]=="no"){
$disabled="<img src='".$site_config[SITEURL]."/images/disabled.png' alt='disabled' border=0>";
}else{ $disabled=""; }
return unesc("<font color='".$col."'>".$name."".$star."".$warn."".$disabled."</font>");
}
//end class colors function
In config add ( if colour function mod already installed just update)
// class colors
$site_config['owner_color'] = '#FF0000'; // Owner / Red
$site_config['admin_color'] = '#ff9900'; // Admin / Maroon
$site_config['super_mod_color'] = '#00ff00'; // Super Mod / Lime
$site_config['moderator_color'] = '#00cc00'; // Moderator / Green
$site_config['vip_color'] = '#d9bb24'; // VIP / Gold
$site_config['uploader_color'] = '#ffff00'; // Uploader / Yellow
$site_config['addict_color'] = '#0000ff'; // Addict / Blue
$site_config['pro_user_color'] = '#005080'; // Pro User / Navy
$site_config['power_user_color'] = '#008080'; // Power User / Teal
$site_config['member_color'] = '#fff'; // Member / Black
$site_config['leecher_color'] = '#ff00ff'; // Leecher / Pinkin account_signup.php find ( now new members are class 2 )
$signupclass = '1';change to
$signupclass = '2';In cleanup.php find
//ORIGINAL OPTIMIZE TABLES
Add before
//===| Start Auto Promote/Demote Users |===//
//===| config
$minratio = 0.9; # ratio for demotion to LEECHER
$gigs3 = 50 * 1073741824; # 50 GB
$gigs4 = 150 * 1073741824; # 150 GB
$gigs5 = 250 * 1073741824; # 250 GB
$class1 = 1; // class 1
$class2 = 2; // class 2
$class3 = 3; // class 3
$class4 = 4; // class 4
$class5 = 5; // class 5
$delay2 = sqlesc(get_date_time(gmtime() - 1 * 1)); # Joined > 1 month
// auto promote to class 2 has ratio above 1
$res = SQL_Query_exec("SELECT id, username FROM users WHERE class = 1 AND uploaded / downloaded > $minratio");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
$res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class2 LIMIT 1");
if (mysqli_num_rows($res_classname) == 1) {
$arr_classname = mysqli_fetch_assoc($res_classname);
$new_classname = "$arr_classname[level]";
}
$username = $arr[username];
SQL_Query_exec("UPDATE users SET class = $class2 WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Member class. Please note that if your ratio drops below " . $minratio . " at any time, you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}
// auto demote to leecher members with ratio below 1
$res = SQL_Query_exec("SELECT id, username, modcomment FROM users WHERE (class = $class2 || class = $class3 || class = $class4 || class = $class5) AND uploaded / downloaded < $minratio");
while ($arr = mysqli_fetch_assoc($res)) {
$username = $arr[username];
$modcomment = $arr[modcomment];
$modcomment2 = gmdate("d-M-Y") . " - Has been demoted by System to Leecher \n";
$modcomment = $modcomment2 . "" . $modcomment;
$modcom = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET class = 1, modcomment = CONCAT($modcom,modcomment) WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'You were automatically demoted to Leecher. That happened because your ratio dropped below " . $minratio . "', 'You have been demoted to Leecher')");
write_log("<a href=account-details.php?id=$arr[id]><b>$username</b></a> has been demoted by System to <b>Leecher</b> class");
}
// auto promote to class 3
$res = SQL_Query_exec("SELECT id, username FROM users WHERE (class = $class1 || class = $class2) AND warned = 'no' AND added < $delay2 AND uploaded >= $gigs3 AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
$res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class3 LIMIT 1");
if (mysqli_num_rows($res_classname) == 1) {
$arr_classname = mysqli_fetch_assoc($res_classname);
$new_classname = "$arr_classname[level]";
}
$username = $arr[username];
SQL_Query_exec("UPDATE users SET class = $class3 WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Power User class. Please note that if your ratio drops below " . $minratio . " at any time, you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}
// auto promote to class 4
$res = SQL_Query_exec("SELECT id, username FROM users WHERE (class = $class1 || class = $class2 || class = $class3) AND warned = 'no' AND added < $delay2 AND uploaded >= $gigs4 AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
$res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class4 LIMIT 1");
if (mysqli_num_rows($res_classname) == 1) {
$arr_classname = mysqli_fetch_assoc($res_classname);
$new_classname = "$arr_classname[level]";
}
$username = $arr[username];
SQL_Query_exec("UPDATE users SET class = $class4 WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Pro User class. Please note that if your ratio drops below " . $minratio . " at any time, you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}
// auto promote to class 5
$res = SQL_Query_exec("SELECT id, username FROM users WHERE (class = $class1 || class = $class2 || class = $class3 || class = $class4) AND warned = 'no' AND added < $delay2 AND uploaded >= $gigs5 AND uploaded >= downloaded");
$time = get_date_time();
while ($arr = mysqli_fetch_assoc($res)) {
$res_classname = SQL_Query_exec("SELECT level FROM groups WHERE group_id=$class5 LIMIT 1");
if (mysqli_num_rows($res_classname) == 1) {
$arr_classname = mysqli_fetch_assoc($res_classname);
$new_classname = "$arr_classname[level]";
}
$username = $arr[username];
SQL_Query_exec("UPDATE users SET class = $class5 WHERE id = $arr[id]");
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, $arr[id], '$time', 'Congratulations, you were automatically promoted to Addict class. Please note that if your ratio drops below " . $minratio . " at any time, you will be demoted to Leecher', 'You have been promoted as " . $new_classname . "')");
unset($res, $arr, $res_classname, $arr_classname,$new_classname);
}
[color=rgb(251, 160, 38)]I also have automation & demotion for uploaders from TTfr just add after the code above (cleanup.php)[/color]
// uploader mod test promote if 3 uploads in 2 weeks
$query = SQL_Query_exec('SELECT torrents.owner, COUNT(*) AS counta FROM torrents INNER JOIN users ON (torrents.owner=users.id) WHERE users.class < "4" and users.donated = "0" and torrents.banned = "no" and torrents.added > DATE_SUB(NOW(), INTERVAL 15 DAY) GROUP BY torrents.owner');
while ($UP = mysqli_fetch_assoc ($query)){
if ($UP['counta'] > 3){
SQL_Query_exec ('UPDATE users SET class = 6 WHERE id = ' . sqlesc ($UP['owner']).'');
$subject = 'Automatic Promotion To Uploader Status';
$msg = 'Hello you did 1 upload, you are promoted to Uploader, Bravo !!! ';
SQL_Query_exec("INSERT INTO `messages` (`sender`, `receiver`, `added`, `subject`, `msg`, `unread`, `location`) VALUES ('0', '".$UP[owner]."','".get_date_time()."', '$subject', '$msg', 'yes', 'in')");
}
}
// Uploader demote if he did not upload 1 torrent over 2 week
$nbre = 0;
$query = SQL_Query_exec('SELECT id, username FROM users WHERE class = 6 ');
while ($up = mysqli_fetch_assoc ($query)){
$query2 = SQL_Query_exec('SELECT name, added, DATE_SUB(NOW(), INTERVAL 15 DAY) AS date_expiration FROM torrents WHERE owner = '.$up['id'].'');
while ($up2 = mysqli_fetch_assoc ($query2)){
if ($up2["added"] > $up2["date_expiration"])
$nbre = $nbre + 1;
else
$nbre = $nbre;
}
if ($nbre < 1){
SQL_Query_exec('UPDATE users SET class = 2 WHERE id = ' . sqlesc ($up['id']).'');
$subject = 'Automatic Downgrading to Member Status';
$msg = 'You have not uploaded in the last fortnight so you have been demoted from uploader.';
SQL_Query_exec("INSERT INTO `messages` (`sender`, `receiver`, `added`, `subject`, `msg`, `unread`, `location`) VALUES ('0', '".$up[id]."', '".get_date_time()."', '$subject', '$msg', 'yes', 'in')");
}
$nbre = 0;
} [color=rgb(251, 160, 38)]In footer.php add links if you wish find[/color]
<!-- START FOOTER CODE -->before
<center><a href="memberlist.php?search=&class=11"><font size="2" color="#cc0000"><b>Owner</b></font></a>
<a href="memberlist.php?search=&class=10"><font size="2" color="#ff9900"><b>Admin</b></font></a>
<a href="memberlist.php?search=&class=9"><font size="2" color="#00ff00"><b>Super Mod</b></font></a>
<a href="memberlist.php?search=&class=8"><font size="2" color="#00cc00"><b>Moderator</b></font></a>
<a href="memberlist.php?search=&class=7"><font size="2" color="#d9bb24"><b>VIP</b></font></a>
<a href="memberlist.php?search=&class=6"><font size="2" color="#FFff00"><b>Uploader</b></font></a>
<a href="memberlist.php?search=&class=5"><font size="2" color="#0000ff"><b>Addict</b></font></a>
<a href="memberlist.php?search=&class=4"><font size="2" color="#005080"><b>Pro User</b></font></a>
<a href="memberlist.php?search=&class=3"><font size="2" color="#008080"><b>Power User</b></font></a>
<a href="memberlist.php?search=&class=2"><font size="2" color="#fff"><b>Member</b></font></a>
<a href="memberlist.php?search=&class=1"><font size="2" color="#ff00ff"><b>Leecher</b></font></a>
</center><br />
