BP Profile Search › Search directory results page display all members ignoring search criteria.
-
AuthorPost
-
Rizwan A. Khan
GuestHi,
1. I created two search forms called Search (Basic Search) and Advance Search.
2. I created a page called “Search Profiles” and added [bps_directory] shortcode to that page.
3. I selected directory results page in both forms search forms as “Search Profiles”
4. I also made “Add to directory” both search forms.However when I search any criteria on my “search Profiles” page I get the whole directory listed. For example I select age range 18 to 20 but I get in the results page listing all members including those with higher age.
Please help.
andrea
Plugin AuthorHi Rizwan,
Could you please send me a test login to your site? You can use my Contact page to keep it private.
Rizwan A. Khan
GuestThank you andrea. Sent you private message. Kindly check.
I would like to add that the members page will only show you female profiles. Also to female users it will only show male profiles. I have added the code into functions.php of my child theme. But I dont think that is the reason of this problem as I even tried disabling this customization.
Rizwan A. Khan
GuestHi,
I am still waiting for the solution to this problem. Can you please look into this please?
andrea
Plugin AuthorHi Rizwan,
I sent you an email two days ago, I’m going to send it again.
Rizwan A. Khan
GuestThank you Andrea,
Sorry I overlooked your email. However I figured out the problem myself. It was the code that was creating the problem to me that I added to functions.php. After removing that code the plugin works perfectly.My purpose is to create customized members page such that male members should be able to see only female members and vice versa. Is this possible with your plugin? If not what is the alternative?
Rizwan A. Khan
GuestTo achieve the criteria I mentioned in my post I added the code below into functions.php of theme. The moment I add this code the BP profile search stops working and lists all members.
add_filter ('bp_ajax_querystring', 'modify_members_loop', 20, 2); function modify_members_loop ($qs=false, $object=false) { global $wpdb; if ($object != 'members') return $qs; // figure out if the logged-in user is male or female $gender = xprofile_get_field_data (2394, bp_loggedin_user_id ()); if ($gender == 'Male') $query = "SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 2394 AND value = 'Female'"; else $query = "SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 2394 AND value = 'Male'"; $custom_ids = $wpdb->get_col ($query); $args = wp_parse_args ($qs); $args['include'] = implode (',', $custom_ids); $qs = build_query ($args); return $qs; }andrea
Plugin AuthorHi Rizwan,
Thank you for the code, it will help me understand what the problem is. I’ll keep you informed!
andrea
Plugin AuthorHello Rizwan,
Your code works for me. If you wish I could have a look at your site to understand why it doesn’t work for you.
Rizwan A. Khan
GuestHi Andrea,
I did some research into this problem and finally caught the culprit. The plugin paid membership pro for buddypress is the issue. When I install this plugin then BP search do not work but with ONLY paid membership pro it works good. The moment paid membership for buddypress addon is installed BP search gives problem.It seems BP search is not yet compatible with paid membership for buddypress
andrea
Plugin AuthorHi Rizwan,
Great you found the explanation of this problem!
We have the same issue with another plugin, see:
http://dontdream.it/bp-profile-search/incompatible-plugins/
I will download a copy of the Paid Memberships Pro software, and I will investigate further. I’ll let you know what I find out.
Rizwan A. Khan
GuestAll the best. Any way I dumped Paid Pro for buddypress and did the coding myself to achieve my requirements.
Just a suggestion about BP profile search –> Is it possible to have chosen JS search field for search items?
andrea
Plugin AuthorI’m sorry Rizwan, I’m not sure I understand your suggestion, could you please add more details? Thanks!
By the way, I think I found the fix for Paid Memberships Pro – BuddyPress Add On and I’m going to report that to their team.
Rizwan A. Khan
GuestWhat I mean is a multi selection drop down. Suppose my search includes language. Then during the search the user should be able to select multiple languages in the dropdown selection.
andrea
Plugin AuthorGot it!
In the Edit Form screen, if you choose the Search Mode ‘is one of’ for your language field, you’ll get language check boxes in your search form.
If you prefer a multi selection drop down, you also have to add this code to your bp-custom.php file:
add_action ('bps_field_before_search_form', 'change_display'); function change_display ($f) { // replace 789 with the ID of your language field if ($f->id == 789) $f->display = 'multiselectbox'; }Rizwan A. Khan
GuestThank you very much dear Andrea. tested. It works. However it would be better if you can include in your future release a multi-selection in which one can select items from dropdowns and it adds them to something like text field multiple items. This is what I meant by chosen JS search.
andrea
Plugin AuthorYou are welcome! And I’m adding your suggestion to my to-do list.
-
AuthorPost