function kerim_alp_get_user_course_ids_from_orders($user_id = 0) { if (!$user_id || !function_exists('wc_get_orders')) return []; $orders = wc_get_orders([ 'customer_id' => $user_id, 'status' => ['completed','processing','on-hold'], 'limit' => -1, ]); if (!$orders) return []; $product_ids = []; foreach ($orders as $order) { foreach ($order->get_items() as $item) { $product_ids[] = $item->get_product_id(); } } $product_ids = array_unique(array_filter($product_ids)); if (!$product_ids) return []; $courses = get_posts([ 'post_type' => 'ka_course', 'numberposts' => -1, 'post_status' => 'publish', 'meta_query' => [[ 'key' => '_ka_course_product_id', 'value' => $product_ids, 'compare' => 'IN', ]] ]); return $courses ?: []; } function kerim_alp_wc_thankyou_redirect($order_id) { if (!$order_id || is_admin()) return; $redirect = kerim_alp_get_option('post_purchase_redirect', home_url('/panelim/')); if ($redirect) { $redirect = add_query_arg('ka_purchase', 'success', $redirect); wp_safe_redirect($redirect); exit; } } add_action('woocommerce_thankyou', 'kerim_alp_wc_thankyou_redirect', 20); function kerim_alp_payment_success_notice() { if (!is_user_logged_in()) return; if (empty($_GET['ka_purchase']) || $_GET['ka_purchase'] !== 'success') return; $text = kerim_alp_get_option('welcome_notice_text', 'Satın alma başarılı. Eğitim paneline hoş geldin.'); echo '
' . esc_html($text) . '
'; echo ''; echo ''; echo 'Büyük bir şey hazırlanıyor! Mağazamız üzerinde çalışılıyor ve yakında yayınlanacak!