fix(admin): let editPlus subtract Plus/bonus days as the form advertises (#254)

This commit is contained in:
Ferywir
2026-06-22 17:41:28 +02:00
committed by GitHub
parent 6e79c47951
commit 6888a09b5f
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ if($id){
<input type="hidden" name="uid" value="<?php echo $uid;?>">
<input type="hidden" name="id" value="<?php echo $id;?>">
<div class="info-box"> The values add up. Put 5 to add 5 days.</div>
<div class="info-box"> The values add up. Put 5 to add 5 days, -5 to remove 5 days.</div>
<div class="card">
<h3>📊 Current Active Bonuses</h3>
+3 -1
View File
@@ -64,7 +64,9 @@ if (!$user) {
foreach ($bonusDuration as $key => $add) {
$current = (int)($user[$key] ?? 0);
$base = $current < $time ? $time : $current;
$bonusDuration[$key] = $add > 0 ? $base + $add : $current;
// A negative value subtracts days (the form advertises "Add / Remove Days").
// 0 leaves the current expiry untouched; the clamp below caps it at "expired".
$bonusDuration[$key] = $add != 0 ? $base + $add : $current;
if ($bonusDuration[$key] < $time) {
$bonusDuration[$key] = 0;
}