Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Filter posts based on User Flag (Membership or ACF or User Role or ??)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Blake Miller
    #271594

    I’m trying to filter posts from a Dynamic Posts feed based on User type (either Membership or Role or ACF field or ??)

    Background… I have an events site with an Agenda made up of custom post type “Events”. I am feeding all of the events onto the Agenda page using Dynamic.ooo’s Dynamic Posts v2. Also using Search & Filter Pro to provide some searching and filtering based on Taxonomies, etc.

    BUT, we will have different users (“attendees) on the site and certain users can only view/access certain Events in the feed. I can block access to a given post using a Membership Plugin or even WP User Role and access rules. BUT, how can I prevent such events from even showing up in the feed?

    I plan to have a taxonomy or field (or fields) attached to each event/cpt and a corresponding fields attached to the User. So if a user is “Regular attendee, they will see a filtered subset of events/posts with the Regular taxonomy set. Where a VIP attendee will see ALL events/posts. Also, there are a bunch more different attendee types, groupings and combinations than the example above. I will have dozens of different combinations.

    Essentially, I need a custom feed for different users (based on Membership Type, User Role, ACF Field or some sort of tag/flag.)

    I’m not even sure this is a Search & Filter pro item, but I’m hitting all bases to find a solution.

    Trevor Moderator
    #271597

    You might be able to do it with code (but it is not something I have tried, so I would not be much help in the actual coding), using this filter:

    https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments

    The filter accepts arguments in the same way that wp_query() does.

    Your code would first check if the user is logged in, and if so what role they have, and then you would add arguments to the query to filter the posts accordingly. I am not sure it would work, but it is I can think of. I am unsure if it would pre-filter the results though, or only work after a query has been made.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.