[buddypress-trac] [BuddyPress Trac] #4017: Group taxonomy
noreply at wordpress.org
Wed Jul 9 03:42:33 UTC 2014
#4017: Group taxonomy
Reporter: boonebgorges | Owner: boonebgorges
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Groups | Version:
Severity: major | Resolution:
Keywords: has-patch |
Comment (by r-a-y):
I've been playing with imath's patch for the past day and overall it's
I came across a few bugs and have added a few enhancements in `02.patch`.
`02.patch` does the following:
* Fix issues with querying for terms when not on the root blog
* In the `BP_Terms` class, I have removed the `setup_globals()` method
and all class properties relating to the taxonomy tables and replaced it
with `switch_to_blog()` / `restore_current_blog()` instead. This is way
* Fix issues with the group tag box if `BP_ROOT_BLOG` is not 1.
* Adds `BP_Terms::get_terms_to_edit()` and
`bp_core_get_terms_to_edit()`. `bp_core_get_terms_to_edit()` is used in
`bp_tags_meta_box()` in place of `get_terms_to_edit()`.
* Registers the "Groups" admin menu on the root blog's dashboard
* I actually think this makes a whole lot of sense because as an
admin, sometimes I won't be in the network admin area and will need to do
some administrative stuff in the root blog dashboard. Need some feedback
* Registers the "Groups > Group Tags" menu
* Removes the code associated with displaying "Groups > Group Tags"
page in the Network Admin area
* Instead, if in the Network Admin area and you click on "Groups >
Group Tags", you get redirected to the root blog's "Group > Group Tags"
page. This prevents having to duplicate the validation and saving of
group tags in the network admin area (lines 1581 and on in bp-groups-
admin.php are basically omitted from imath's patch`).
* When querying for a group tag, I've made things a little easier. In
`bp_has_groups()`, you can pass the following:
* `array( 'type' => 'tag', 'slug' => 'THE_TAG_SLUG' )`
* Previously, you'd need to know how to use WP's tax query if you
wanted to query for groups with a specific tag. The method above is much
* Moves the frontend "Group Tags" fields from the templates into a hook
(see `bp_groups_tag_add_field_to_frontend_group_admin()`). This is so
themes that have already overriden some of the group templates will
inherit these new fields.
* Modifies the look of a single group tag page on the group directory.
* If a group tag is being displayed, a "Tags" tab is added next to the
"All Groups" and "My Groups" tabs and the group tag header is displayed
before the group loop. This allows AJAX to work if you decide to click on
"All Groups" or "My Groups".
* Some cookie manipulation is needed here to set the proper scope (see
`bp_groups_tag_set_scope()`). Kinda hacky.
This patch is not commit-worthy by any means. I just wanted to put
something up for review.
In future iterations, I'd like to break out all group tag code into its
own file - `bp-groups-tags.php` and make it so group tag functionality can
be disabled with a filter.
We should split up the patch into two. The register taxonomy code,
`BP_Terms` class and its related functions could be committed for 2.1 to
lay the groundwork for group tags in 2.2.
And in the spirit of boonebgorges, we need unit tests ;)
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4017#comment:15>
BuddyPress Trac <http://buddypress.org/>
More information about the buddypress-trac