This is just an mod that auto demote uploaders if they didnt upload any torrents in 2 days
add in cleanup before last ?>
change u.class = 9 with your uploader class
change $maxdt = get_date_time(gmtime() - 86400*7); with how many days you want to give for uploaders .
You can add warn
add in cleanup before last ?>
// Demote Uploaders if NO UPLOADS in 7 days
$maxdt = get_date_time(gmtime() - 86400 * 7);
$maxdt = sqlesc($maxdt);
$res = SQL_Query_exec("
SELECT u.id, u.username, u.modcomment, COUNT(t.owner) AS upload_count
FROM users u
LEFT JOIN torrents t ON t.owner = u.id AND t.added > $maxdt
WHERE u.class = 9
GROUP BY u.id, u.username
", [$maxdt]);
if (mysqli_num_rows($res) > 0) {
$dt = get_date_time();
$msg = "Unfortunately, you have been demoted from UPLOADER to Flat Cested due to not uploading any torrents in the last 7 days.";
$msg = sqlesc($msg);
while ($arr = mysqli_fetch_assoc($res)) {
$userId = $arr['id'];
$username = $arr['username'];
$modcomment = $arr['modcomment'];
$uploadCount = $arr['upload_count'];
if ($uploadCount == 0) {
$modcomment = gmdate("Y-m-d") . " - Has been demoted from Uploader to Flat Cested. No uploads in 7 days\n " . $modcomment;
$modcomment = sqlesc($modcomment);
SQL_Query_exec("UPDATE users SET modcomment = modcomment, class = 1 WHERE id = $userId", [$modcomment, $userId]);
SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster) VALUES (0, $userId, $dt, $msg, 0)", [$userId, $dt, $msg]);
write_log("User <a href=account-details.php?id=$userId>$username</a> was automatically demoted from Uploader to Flat Cested by the system. Reason: No uploads for 7 Days");
}
}
}change u.class = 9 with your uploader class
change $maxdt = get_date_time(gmtime() - 86400*7); with how many days you want to give for uploaders .
You can add warn
Last edited by djlive on 2023-07-07 11:59:19