BP Member Filter
Super preliminary “you broke it you bought it” edition… This plugin for BuddyPress will allow you to filter users by XProfile fields when viewing your members directory.
Just waiting for the WP plugin repo before this goes there.
index.php and members-loop.php will go in…
…or in the same location in your custom theme. They will *need* to be modified to fit the xprofile fields you intend to filter users by. I’ve included some examples in index.php.
Updated: zip file added until repo is done.
Found my first bug: ajax’ed pagination borks it. Bug fixes to follow! Haha!
I want to thank you for this, but I don’t even know what ‘xprofile fields’ refers to!
Extended Profile – Basically the profile fields you setup for your audience
An example would be here at buddypress.org, if you wanted to search for people who put “puppies” in their interests field. Rather than searching for puppies and possibly getting someone with the name “I Love Puppies” it will isolate your search down to the field you’re searching in.
Clear as mud? Haha
I believe the xprofile fields are the fields like “name”, so basically your users their account details.
I like the fact that you can order your users like this, A to Z is kinda… lame and outdated. I’ll definately try this out later. Thanks JJJ.
Edit: JJJ was 51 seconds faster then me.
Sweet, gotcha. I’ll be playing with this later, if the beer doesn’t intervene. Thanks!
Edit: Oooh, awesome, so if I have users fill out a City field, say, we could optionally sort/group the Members page (on the fly?) to show people in each city that’s been entered, for example? That will kick all kinds of butt!
Nice job! I’ll give this a whirl this weekend.
There’s a small problem in the logic filter, so the results are sometimes not 100% accurate. It happens when searching for multiple fields, so that will get fixed after this weekend also.
suggestion: popular keywords. similar to auto-tags based on post content, would be amazing for big sites to have the same for profile fields, so we have a cloud (or a dropdown) of popular profile field answers.
challenging i suppose.. lol
Actually not really… I planned on filtering longer list items by only populated fields. Like “Country” is a good example that may have hundreds of options, but you may only have 10 or so actually in use.
Good suggestion though, and it will probably happen in time.
i installed it… and it is the best example possible for the suggestion i made for a /bp-plugins/ directory… we can not actually install this plugin on the fly with the installer, we need to move files around. we also have to replace two files… that could be a problem if we have another product that need to overwrite these 2 files again. (adding actions into these files is needed though)
bp-profile-setup : when we setup some custom field, would be good to have a checkbox “is searchable”… so we can filter or search thru these fields only when possible. this could be good if we want to avoid some details to be trackable…
@nexia, you’re exactly right and thinking in the right direction.
What you’ll probably start to see are more and more plugins coming out that eventually sneak their way into the core, in one way or another. Something like an elaborate and advanced user/group/blog filtering system is a little too fancy and needs access to core variables and functions in too many places to only be a plugin for very long.
This plugin is actually on the core roadmap for 1.3 (I think?) so it’s likely it will be worked into the core. Some of the smaller plugins (from me) in the coming weeks will probably be sneak peaks into the future of BP core that I think need testing and feedback.
Is this the type of plugin that I need to display different groups of members and members activity on each of my blogs?
Meaning, I am still trying to figure out how to give each of my blogs on wpmu their ‘own’ buddypress. (only show members/groups/activity streams of the blog being displayed –think ‘ning’ where each site has their own ‘bp’ yet all members are still part of the ning community)…
Is that even possible with bp, and if so, is this the type of plugins I should be looking into for this type of functionality?
@jjj, Glad to hear it. I think BPContents needs to be in core in some fashion. It’s basically content types for BP. It’s important in making WP a more flexible CMS.
I have all kinds of user levels/types and group types I’m thinking of and each has different permissions/capabilities, not to mention look and feel. I don’t see it explicitly in the roadmap, but given the plugin development already done, I’m voting for it – as if my vote counts.
this is awesome,
many thanks james!
however it does not work for checkboxes (for me),
I think this is because of the code from the bp-filter.php
<?php case 'checkbox' : ?><br />
<div class="checkbox"><br />
<span class="label"><?php _e( bp_get_the_profile_field_name(), BP_FILTER_TEXTDOMAIN ) ?></span><br />
<?php //bp_filter_the_profile_field_options() ?><br />
<?php break; ?>
any fixes for that?
when I delete the // the page halts (error).
I have still not been able to get it working correctly. I am working on a non-profit project to display different members based on different custom profile values, but till now to no success ;(
can anyone help me out or give me a pointer?
I think this is pretty much the right plugin for the purpose.
I think I narrowed the problem down:
the output seems to go bust when there are more than one results.
I can query the members for different profile fields, but as soon as there are more than one hit, the function halts (cut off in html when viewing source).
with error reporting on it shows: (sorry for breaking the lines)
Notice: Undefined variable: field_filter_last_users in
/var/www/vhosts/domain.com/httpdocs/wp-content/plugins/bp-filter.php on line 150
Notice: Undefined variable: temp_array in
/var/www/vhosts/domain.com/httpdocs/wp-content/plugins/bp-filter.php on line 170
Catchable fatal error: Object of class stdClass could not be converted to string in
/var/www/vhosts/domain.com/httpdocs/wp-content/plugins/bp-filter.php on line 174
the fatal line is:
// Remove duplicate user_id's<br />
$temp_array = array_unique( $temp_array );
any clues or tipps?
YAY!! uncommenting that line fixes it!!
… but still… the selectbox issue remains, no select boxes for me with this release!
in bp-filter.php there is a line commented out in regards to selectboxes. when “activating” it,
Fatal error: Call to undefined function bp_filter_the_profile_field_options() in /var/www/vhosts/domain.com/httpdocs/wp-content/plugins/bp-filter.php on line 257
- this function is not added yet, correctly?
now the problem is: dropdown boxes work, but when saving profiles the data is not saved when using dropdown boxes (I have to use selectboxes there). when using selectboxes with this filter, the selectboxes are not displayed!
anything I am missing?
I found it…
line 369: // TODO: This
I would happily help out or donate towards development of this part, anyone to reply?
I have modified the original bp-filter to show checkboxes now (the “to-do” part)
it is really a bit quirky for now, but does its basic job.
sometimes the output shows false results, but so far it is looking good.
I am not a php programmer, so the modified code may be entirely buggy:
As you found, there’s some parts of this plugin that are still left to do, namely checkboxes and better trapping of false results.
This plugin is in active development, so I’ll be working on it more this week.
great, thank you jjj
I also noticed that the filter by alphabetical order seems not to work as members listed appear in apparently random order.
If you need any testers, let me know.
I just downloaded this, so I haven’t installed it yet. But, just wondering how hard it would be, or is it even possible, to do a search between two fields, such as an age range. (eg: Find all users between ages of 25-35). Could this work? Thanks!
Does anyone have a live site using this that we can take a look at? Please post. I’m going to try to implement it this week and I’ll share my results.
This plugin doesn’t perform logic searches within fields, but it does allow you to search for criteria in any xprofile field and any combination of them (except checkboxes at the moment.)
@michaelesenwasser, not yet that I know of.
has anyone gotten this to work with the latest version of buddypress? I downloaded it at http://wordpress.org/extend/plugins/bp-member-filter, installed it but i can’t find the right files to change (the members.php). This plugin is exactly what my site needs, and i can’t wait to use it.
The topic ‘BP Member Filter’ is closed to new replies.