[buddypress-trac] [BuddyPress Trac] #6014: Include BP Edit Group Slug into the core

buddypress-trac noreply at wordpress.org
Sat Nov 15 18:26:46 UTC 2014

#6014: Include BP Edit Group Slug into the core
 Reporter:  slaFFik      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Groups       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |
Changes (by r-a-y):

 * type:  task => enhancement


 > Changing a slug means breaking backward compatibility with existing

 I recently did something for username change redirection.  This is what I

 * I hooked on the `bp_do_404` action and detected if we're trying to load
 an invalid group page.  Note: This highly relied on the
 `$bp_unfiltered_uri` global, which would probably break when moving to
 rewrite rules.
 * Next, I grabbed an option containing group slug changes.  eg.
 `bp_get_option( 'bp_group_slug_changes')`.  Result is an array that looks
 like this - `[oldslug] => GROUP_ID`.
 * If the old slug matches a key in the array, do a `str_replace()` in the
 requested URL with the new group slug and redirect.  This would handle the
 `primary_link` and `action` problem without having to alter anything in
 the DB.

 To me, this is the most economical way of doing redirections because we do
 it when we absolutely need to (during a 404) and without having to tack on
 a rewrite rule in WP.

 The only problem I see is using `bp_get_option()`.  If there are a ton of
 group slug changes, then this isn't the best storage model.  Could
 probably use groupmeta, but the `SELECT meta_value` lookup would suck.
 However, since redirections would probably be done infrequently, it might
 be okay to use groupmeta.

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

More information about the buddypress-trac mailing list