[buddypress-trac] [BuddyPress Trac] #6286: Directories filtered by member roles

buddypress-trac noreply at wordpress.org
Mon Mar 30 18:56:30 UTC 2015

#6286: Directories filtered by member roles
 Reporter:  sooskriszta   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  2.3
Component:  API           |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
Changes (by boonebgorges):

 * keywords:   => has-patch
 * milestone:  Future Release => 2.3


 [attacment:6286.patch] is a first pass at adding member-type directories.
 Here's how it works:

 * I've introduced the 'bp_register_member_type' hook. Member types must be
 registered here (instead of 'bp_init') in order to exist early enough to
 be detected during `bp_core_set_uri_globals()`.
 * `bp_register_member_type()` accepts a 'has_directory' param. Defaults to
 `true`. When `true`, the member type name is used as the slug. When a
 string value, that string value is used as the slug. When `false`,
 directories are disabled for the member type.
 * URLs then look like `example.com/members/foo`, where 'foo' is the member
 type (or value of 'has_directory'). `bp_core_set_uri_globals()` has been
 reconfigured to make this work - this is the most fragile part of the
 patch, because `bp_core_set_uri_globals()` is such a beast. Unit tests are
 passing, but more will probably need to be written than what exist and are
 in this patch.
 * The use of `$_GET['member_type']` is also supported
 (example.com/members/?member_type=foo). In a fight between
 `example.com/members/foo` and `example.com/members/?member_type=bar`,
 `foo` wins.

 I'd welcome feedback on the strategy here - in particular, the new
 'bp_register_member_types' hook, the changes in
 `bp_core_set_uri_globals()`, and the 'has_directory' syntax I've chosen.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6286#comment:9>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list