Change reject action to delete user from database to allow re-registration
This commit is contained in:
@@ -36,11 +36,10 @@ if($uStmt){
|
||||
$uStmt->close();
|
||||
}
|
||||
|
||||
// 2. Perform the update
|
||||
$st = $conn->prepare('UPDATE users SET status = "rejected", rejection_reason = ?, approved_by = ?, approved_at = NOW() WHERE id = ?');
|
||||
// 2. Perform the delete
|
||||
$st = $conn->prepare('DELETE FROM users WHERE id = ?');
|
||||
if(!$st){ http_response_code(500); echo json_encode(['success'=>false,'error'=>$conn->error]); exit; }
|
||||
$adminId = intval(get_current_user_info()['id']);
|
||||
$st->bind_param('sii', $reason, $adminId, $id);
|
||||
$st->bind_param('i', $id);
|
||||
$res = $st->execute();
|
||||
$st->close();
|
||||
if(!$res){ http_response_code(500); echo json_encode(['success'=>false,'error'=>$conn->error]); exit; }
|
||||
|
||||
Reference in New Issue
Block a user