Upload folder via GUI - includes
This commit is contained in:
@@ -28,6 +28,7 @@ class WBF_Ajax {
|
||||
'wbf_2fa_setup_verify',
|
||||
'wbf_2fa_disable',
|
||||
'wbf_2fa_verify_login',
|
||||
'wbf_cancel_abo',
|
||||
];
|
||||
foreach ($actions as $action) {
|
||||
add_action('wp_ajax_nopriv_' . $action, [__CLASS__, str_replace('wbf_','handle_',$action)]);
|
||||
@@ -1833,6 +1834,47 @@ class WBF_Ajax {
|
||||
] );
|
||||
}
|
||||
|
||||
// ── Abo kündigen ──────────────────────────────────────────────────────────
|
||||
|
||||
public static function handle_cancel_abo() {
|
||||
self::verify();
|
||||
|
||||
$current = WBF_Auth::get_current_user();
|
||||
if ( ! $current ) {
|
||||
wp_send_json_error(['message' => 'Nicht eingeloggt.']);
|
||||
return;
|
||||
}
|
||||
|
||||
$type = sanitize_key($_POST['type'] ?? '');
|
||||
if ( ! in_array($type, ['fly_abo', 'plot_abo'], true) ) {
|
||||
wp_send_json_error(['message' => 'Ungültiger Abo-Typ.']);
|
||||
return;
|
||||
}
|
||||
|
||||
// MC-Name ermitteln (Spielername = Forum-Username oder verknüpfter MC-Name)
|
||||
$mc_name = '';
|
||||
if ( class_exists('WBF_MC_Bridge') ) {
|
||||
$mc_name = WBF_MC_Bridge::get_mc_name($current->id) ?: '';
|
||||
}
|
||||
if ( empty($mc_name) ) {
|
||||
// Fallback: Forum-Username = Minecraft-Name
|
||||
$mc_name = $current->username;
|
||||
}
|
||||
|
||||
if ( ! class_exists('WBF_Abo') ) {
|
||||
wp_send_json_error(['message' => 'Abo-Modul nicht geladen.']);
|
||||
return;
|
||||
}
|
||||
|
||||
$ok = WBF_Abo::cancel_abo($mc_name, $type);
|
||||
|
||||
if ($ok) {
|
||||
wp_send_json_success(['message' => 'Abo erfolgreich gekündigt.']);
|
||||
} else {
|
||||
wp_send_json_error(['message' => 'Kein aktives Abo gefunden oder bereits gekündigt.']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_action( 'init', [ 'WBF_Ajax', 'init' ] );
|
||||
Reference in New Issue
Block a user