function mdjn_get_wpbdp_listings_for_user($user_id, array $allowed_fee_ids = []) { // 1) Candidate listings by author $ids = get_posts([ 'post_type' => 'wpbdp_listing', 'author' => $user_id, 'post_status' => ['publish','pending','draft','future','private'], 'posts_per_page' => -1, 'fields' => 'ids', 'no_found_rows' => true, ]); // 2) Fallback by owner meta (if needed) if (empty($ids)) { $ids = get_posts([ 'post_type' => 'wpbdp_listing', 'post_status' => ['publish','pending','draft','future','private'], 'posts_per_page' => -1, 'fields' => 'ids', 'no_found_rows' => true, 'meta_query' => [ 'relation' => 'OR', ['key' => 'wpbdp_user_id', 'value' => $user_id, 'compare' => '='], ['key' => '_wpbdp_owner', 'value' => $user_id, 'compare' => '='], ], ]); } if (empty($ids)) return []; $out = []; foreach ($ids as $post_id) { $fee_id = mdjn_get_wpbdp_fee_id($post_id); // helper below // If an allow-filter is set, enforce it if ($allowed_fee_ids && ($fee_id === null || !in_array((int)$fee_id, $allowed_fee_ids, true))) { continue; } $p = get_post($post_id); if (!$p) continue; $out[] = [ 'id' => $p->ID, 'title' => get_the_title($p), 'status' => $p->post_status, 'url' => get_permalink($p), 'created' => get_post_time('c', true, $p), 'modified' => get_post_modified_time('c', true, $p), 'fee_id' => is_null($fee_id) ? null : (int) $fee_id, // ← include fee_id ]; } return $out; } s2 Login - MDJN

s2 Login

SOMETHING

s2Member®