Skip to main content

[Dev Help?] Issues trying to add custom

I just spend a bit of time writing a custom condition for to filter based on Easy Digital Downloads subscription status.

I've tested the queries directly and get what I'm after, but no matter how I hook these filter queries into the CRM Query builder I get issues due to the default {property} {operator} ? that seems to be added to the query irellevant to what we do.

So my proper subquery gets added, but the query errors due to unknown column {property}

Please help. We have a ton of ideas for custom rules, but can't get this one to work.

We have a working Tracking Event special condition that handles querying for JSON event properties, but I think its only working because we are effectively querying on an existing relationship of trackingEvent.

This new one does not use the same relationship as there are no relationships in the QueryBuilder for this by default, but it does add one for a non-existant property (our rule name).

  1. How can we properly filter based on a simple subquery. Subquery can be any variation of a query on subs like so.

id IN (

SELECT fc.subscriber_id FROM wp_edd_subscriptions as sub
LEFT JOIN wp_edd_customers as cust on cust.id = sub.customer_id
LEFT JOIN wp_fc_contact_relations as fc ON fc.provider = 'edd' AND cust.user_id = fc.provider_id
WHERE sub.product_id IN (38995) AND sub.status = 'active';

I've tested adding queries directly to it or via a relationship, neither can work from my tests without some part I must be missing.

https://gist.github.com/danieliser/50d35a2a40b6bedeb5ed635a2df3ed5b2

Rough WIP, tried about 100 ways of querying, using your builder, raw query for the sub Ids to us in a simple query builder IN compare, nothing seems to work.

2 Alternatively, how can we add a custom relationship under the hood, so that we can map our work here to such relationship?

Daniel Iser

Abdul AzijΒ It doesn't appear related to my issue.

I'm trying to add custom conditional rules to the UX, which I can do successfully, but when I try to filter the query for segmenting subscribers it breaks because I'm not comparing to an existing {property} on the subscriber.