BP Profile Search › Number Range Slider
-
AuthorPost
-
Daniel
GuestHi
So I’m implementing a number range slider into BP Profile Search as I think it is something a lot of people would like. I think it would provide a nice UX etc.
So I have it working, but it is currently hardcoded into the plugin, which breaks other functionality, such as other searches.
Is the advice on this page http://dontdream.it/bp-profile-search/custom-profile-field-types/ relevant to help me integrate this in a better way?
What I want to do is:
– if the XProfile Field type is ‘number’ and the user selects ‘range’ in the BP Profile Search admin, then the slider is used
– the slider’s min and max values are used as the min and max for the number range in BP Profile Search.What I would like to do is integrate this without having to edit the core files in the plugin. Could I do this by editing functions.php?
andrea
Plugin AuthorHi Daniel,
Unfortunately you have to edit the plugin files in the current version. The next version will allow users to easily modify the form template, and that will offer a perfect solution to your need.
If you feel adventurous, I can send you a beta of the next version so you can start developing your own form template.
Netsurfaces
GuestHi @andrea
I am having the same issue as Daniel (and need some other customisations, such as letting people choose multiple options from what was originally a simple select i.e. gender: male/female but in the search you could select either/or).
How close to production-ready is your beta?
Your profile is great, it does most of what I need, but the requirement of editing the code rather than templates is indeed a drawback.
Looking forward… and let me know if you need my email to send the beta. The email address I provided here is good.
Thank you!
andrea
Plugin AuthorHello Netsurfaces,
That beta has been released already, and it is BP Profile Search version 4.2. Please give it a try and let me know if you have questions or suggestions.
Netsurfaces
GuestCool! Thank you for the quick reply.
I did add my own template for my search form using a filter on bps_templates, using your search form as starting point, and plan on hacking it pretty heavily.
Question: it has to be placed in your plugin /templates folder, not in my theme? I didn’t quite manage to get it included from my theme and had to place it in your plugin folder.
I want to add sliders to replace the number ranges, and need to add a couple options to the search form that are not part of the search per se (like “distance” from a zip code). I might/should start another thread about this last point specifically, as I have an idea on how to modify the query to involve a geolocation table to return an array of nearby zip codes instead of the actual zip code but am not sure this is the most elegant manner. I’m getting acquainted with your bps_field_sql filter.
Thanks!andrea
Plugin AuthorHi Netsurfaces,
As you noted, it’s better to add any new or modified templates to your theme. You have to create a directory buddypress/members in your theme directory, and put your templates there.
Of course you can also modify the query for a field. Besides the bps_field_sql filter you mentioned, you can also have a look at the bps_field_query filter. If you have questions or suggestions on the query filtering, please let me know!
Netsurfaces
GuestAll good, thank you. The only problem with the bps_field_sql filter is that it’s addictive! I am now doing 1) a zip search 2) an age range to birth date comparison, and 3) a custom option to search for users on the current site, on the sites we have in common, or through the whole network (multisite).
The last one was tricky because that option is a custom field I have to artificially insert into my search form.I am adding a search by groups next (client requirement…………)
I hope this is the right approach, as opposed to adding filtering arguments in the bp_has_members before the members/loop for instance.
andrea
Plugin AuthorThat’s great! My goal is to make customizations simple, so if you have suggestions for improvements, I’m all ears!
About your last question, BP Profile Search uses the bp_ajax_querystring filter to modify the include query arg, and as you may know that arg effectively trumps the internal members search, replacing its results with the include supplied values.
If you wish to add filtering args to bp_has_members() you could use the technique I’m using in bps_filter_members().
-
AuthorPost