Forums › Forums › Search & Filter Pro › One Search Form For Many BuddyPress Groups
- This topic has 7 replies, 2 voices, and was last updated 7 years, 9 months ago by Trevor.
-
Anonymous(Private) January 27, 2017 at 4:41 pm #86143
I have a weird scenario. I have a search form in multiple BuddyPress groups. I want to search for post meta. I want that post meta ifo to be dependent on whichever BuddyPress group I’m in. Is there a way using the shortcode or with a filter to search for that specific post meta?
Anonymous(Private) January 31, 2017 at 2:37 am #86907I have the form on a custom BuddyPress group page and the form is searching for posts with a specific custom field. The custom field is a number and it is the same as the ID of the current BuddyPress group. Basically, I’m trying to search for posts that are attached to the current BuddyPress group I’m in.
Trevor(Private) January 31, 2017 at 2:41 pm #87002mmm. OK. are you creating wordpress pages and then using a shortcode or similar to place a given group on a given page? Do you have a custom field on the pages to hold the ID of the group?
What I am thinking is that you could have a hidden field in the form which is the group (or group ID).
Then, in the child theme functions.php you can have some custom PHP that checks if a page is being loaded, and if it is, to find the value held in the custom field that holds the group ID, and if it does have a group ID, to then use our sf_edit_query_args filter to modify the group ID field in the form to be that of the custom field on that page.
The only problem that I can see is that S&F forms require a results url, which would be different for each page. I cannot see how you would get around this.
-
AuthorPosts