mirror of
https://github.com/myronblair/tomtomgames
synced 2026-06-30 17:51:08 -05:00
Shade disabled payout methods when admin turns them off
- payout_methods list now includes admin_enabled flag via JOIN on admin_payout_settings - Disabled methods appear at 45% opacity with UNAVAILABLE/DISABLED BY ADMIN badge in both the cashout radio list and profile payout tab; radio is disabled so they can't be selected, but the delete button remains - Set Default button hidden on disabled methods - cashout.php server-side guard rejects submissions using a disabled method type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -121,6 +121,16 @@ if ($payoutMethodId) {
|
||||
}
|
||||
}
|
||||
|
||||
// Reject if the payout method type is not currently admin-enabled
|
||||
if ($payoutMethodType) {
|
||||
$enaStmt = db()->prepare("SELECT is_enabled FROM admin_payout_settings WHERE method_key=?");
|
||||
$enaStmt->execute([$payoutMethodType]);
|
||||
$enaRow = $enaStmt->fetch();
|
||||
if (!$enaRow || !$enaRow['is_enabled']) {
|
||||
echo json_encode(['success'=>false,'error'=>'This payout method is no longer available. Please select a different method or add a new one.']); exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Check balance
|
||||
$balStmt = db()->prepare("SELECT tokens FROM users WHERE id=?");
|
||||
$balStmt->execute([$userId]);
|
||||
|
||||
@@ -14,7 +14,14 @@ switch ($action) {
|
||||
|
||||
case 'list':
|
||||
$uid = $isAdmin ? (int)($_GET['user_id'] ?? $userId) : $userId;
|
||||
$rows = db()->prepare("SELECT * FROM payout_methods WHERE user_id=? ORDER BY is_default DESC, id ASC");
|
||||
$rows = db()->prepare("
|
||||
SELECT pm.*,
|
||||
COALESCE(aps.is_enabled, 0) AS admin_enabled
|
||||
FROM payout_methods pm
|
||||
LEFT JOIN admin_payout_settings aps ON aps.method_key = pm.method_type
|
||||
WHERE pm.user_id = ?
|
||||
ORDER BY pm.is_default DESC, pm.id ASC
|
||||
");
|
||||
$rows->execute([$uid]);
|
||||
echo json_encode(['success'=>true, 'methods'=>$rows->fetchAll()]);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user