[buddypress-trac] [BuddyPress] #3428: Better bp-pages integration for third-party components with top-level directories

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Tue Aug 2 20:54:06 UTC 2011

#3428: Better bp-pages integration for third-party components with top-level
 Reporter:  boonebgorges  |      Owner:
     Type:  defect        |     Status:  new
 Priority:  critical      |  Milestone:  1.5
Component:  Core          |    Version:  1.5
 Severity:  critical      |   Keywords:  has-patch 2nd-opinion
 See also #3422, which points to a specific bug in bp-pages and
 bp_core_add_root_component() implementation.

 Integration of third party components into bp-pages is currently minimal
 at best. When a third party component registers itself using the old
 bp_core_add_root_component() method, a new bp-pages page is created, if
 necessary. But after that happens, there is no way to change this page

 The attached patch has a potential solution. It has a few parts:
 - First, components that need top-level directories now must register
 themselves in the following way:
 {{{$bp->component->has_directory = true;}}}
 I've modified the BP_Core_Component class, and the various loader classes,
 accordingly. Components that register themselves in the new way, by
 extending BP_Core_Component, should be able to imitate this in a
 straightforward way.
 - Second, I've added a bit of logic to bp_core_add_root_component() that
 will allow old-style components to (a) be registered in the
 loaded_components array, and (b) be set to has_directory.
 - Third, I've changed the way that Dashboard > Pages displays components.
 Instead of hardcoding them, I'm loading them dynamically out of the $bp
 global: components where has_directory is true get a row on this settings
 page. This allows you to change the bp-pages association for these
 components. (Try it with something like Achievements.)
 - Fourth, I've changed the logic in bp_core_activation_notice() just a
 little, so "orphaned" third-party components show up in the activation

 I think that this is a good way to promote backward-compatibility with the
 old method, and it's also a good way to ensure that third-party components
 are integrated better into our admin UI. I'd love to hear feedback.

 Please note: There is a bug that causes pages to be created ad infinitum
 for components that have no corollary in bp-pages. So if you set a third-
 party component like Achievements to '-None-' on Dashboard > BP > Pages, a
 new page will be created the next time you refresh. This is related to
 #3422, and will have to be fixed at the same time (perhaps we can just
 keep a null value in the bp-pages array for the third-party component
 instead of removing it altogether, or something like that).

 IMO this *must* be fixed for 1.5 release.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3428>
BuddyPress <http://buddypress.org/>

More information about the buddypress-trac mailing list