I need a filter to apply to the [cred-relationship-role role='child'] shortcode.
In short, the [cred-relationship-role role='child'] by default shows all posts available, we can set in the GUI to filter it by author. But, what I need is a hook to filter that list (select2) even further (by a complex custom logic)
What filter should I use for this? I scanned the code and could not find any filter applied to that query, which is restrictive. I thought of using CRED_Potential_Association_Query_Filter_Posts_Author_For_Association_Role (the author filter is defined in there), but it seems the filter only allows to filter by Author ID, which is not what I want.
I need the [cred-relationship-role role='child'] to show only posts defined by my custom logic.
If there is no such filter, what would be the next best solution to have a relationship form select2 show only those posts I want to show?
Our 2nd Tier has escalated this as a feature request to the developers. And the devs have added it to a dev board. Unfortunately, we don't have a filter or a solution to share with you. Using a generic field remains the available solution.
OK thanks for the heads up Jamal, sad but not much we can do about.
I wanted to share the solution I use here (not a generic field as I think AJAX Populating select2 or other select fields is too expensive given it will rely on WordPress AJAX which is generally not the fastest), and I simply am not that conformable with JS as I am with PHP, but the code is a bit too long and also part of a bigger class, so taking it all apart to share here's a bit too much 😛
However if anyone is interested in the solution please feel free to either ask me here or over at my profile/website, I am happy to help.
Cheers, and I hope we will see such feature sometime in the future!