strangerstudios / pmpro-buddypress

Manage access to your BuddyPress Community using Paid Memberships Pro
https://www.paidmembershipspro.com/add-ons/buddypress-integration/
17 stars 21 forks source link

Bug: The” BuddyPress Add On” overrides query_vars and then shows ALL members no matter what search is typed in. #63

Open ipokkel opened 4 years ago

ipokkel commented 4 years ago

User reported the following:

Issue 1- The” BuddyPress Add On” overrides query_vars and then shows ALL members no matter what search is typed in.

Issue 2- Setting “Lockdown BuddyPress?” to NO stops ALL members from showing “Include in Member Directory” should be ignored if lock-down is set to NO

========== to recreate problem ========= Install plugins: Buddypress Paid Memberships Pro Paid Memberships Pro – BuddyPress Add On BP Profile Search (see plugin list for URLs)

Add in some custom fields https://codex.buddypress.org/administrator-guide/extended-profiles/

Create a search form using BP Profile Search

The search results page will show ALL members instead of only the “found members”

Traced the problem to here: /pmpro-buddypress-master/includes/directory.php

– THIS – function pmpro_bp_bp_pre_user_query_construct() – USES – $query_array->query_vars[‘include’] – FORCING – an array of ALL members into the include list It should instead honor any search filters, especially those done by “BP Profile Search”

Because of this any “search queries” are nullified and the search system misbehaves.

Moderators only: https://www.paidmembershipspro.com/forums/topic/bug-report-the-buddypress-add-on-overrides-query_vars-shows-all-members/ (includes video)

zagarskas commented 4 years ago

I feel like the original video is a key part of this bug report https://www.screencast.com/t/t0xHRqvH

I've played with a couple solutions that range from commenting out $query_array->query_vars[‘include’] to merging it back into the query.

TheSashX commented 4 years ago

i have the same problem. is there a fix??

ipokkel commented 4 years ago

Here's a possible workaround that should work with the with the latest versions of BuddyPress v6.0.0, PMPro v2.3.3, and the PMPro BuddyPress Integration v1.2.5. Please be aware this is not a thoroughly tested recipe and is therefore considered as a “use-at-own-risk” option.

https://gist.github.com/ipokkel/bd2ec77bc2104793fd699d3792d34345

andrewlimaza commented 2 years ago

For now, I recommend using the gist @ipokkel provided. The BPS Search plugin is taking over the search query. We need a bit more thought around a solution here.