Use taxonomies instead of/in addition to BP Xprofile tables
|Reported by:||boonebgorges||Owned by:||boonebgorges|
|Component:||Component - XProfile||Keywords:|
|Cc:||vpundir@…, vivek@…, emzo, jonathan@…|
BP's xprofile tables store profile field data (and metadata about fields) in what are essentially key-value pairs. This works well when querying by user id, which is what generally happens on the user profile pages and elsewhere in BuddyPress. However, the unindexed value column means that it's basically impossible to do more complex queries - stuff like "how many users live in Wisconsin or New York, and also are less than 100 years old?". It's technically possible to make these kinds of things work - see http://wordpress.org/extend/plugins/bp-better-directories/ - but the JOINs required are very ugly and very unscalable.
Profile data is many-to-many in structure. And WordPress already has a system for many-to-many metadata: custom taxonomies. I'd like to propose that xprofile field data be stored in a taxonomy instead of a key-value table.
- Exponentially faster complex queries
- We can leverage the core taxonomy API, including caching
- We can remove a bunch of stuff from BP
- Backward compatibility with existing plugins/themes
- Pain in the butt to port
- Some field types do not lend themselves well to taxonomies. In particular, it would be odd to store <textarea> data (multi-line text box) in a taxonomy
I'd want for the xprofile component (at least the query class) to have pretty complete test coverage before attempting anything like this.
Obviously a long-term project and perhaps a pipe dream, but IMO it's one of the most promising areas in BP for getting rid of a custom table or two, while also giving us a ton of cool new features.