Skip to:

Opened 13 years ago

Closed 13 years ago

#3552 closed defect (bug) (fixed)

BP_Component::includes() loaded too early for plugins to extend

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: 1.5 Priority: normal
Severity: normal Version:
Component: Core Keywords:


We currently recommend that BP plugins load themselves at 'bp_include' (implied priority 10). However, this means that they can't take advantage of BP_Component::includes(), which is hooked to bp_include with priority 8. The reason the latter is the case is because core components (in particular, groups) have to be loaded before certain kinds of plugins are loaded (in particular, BP_Group_Extension plugins).

So, a conundrum. A few options:

  • Recommend that plugins authors write their own methods for including files in their BP_Component plugins. In other words, don't use parent::includes( $includes ).
  • Add a new property to core components (like is_core_component or _builtin). If a component is_core_component, hook its include() method to bp_include with priority 8, as it is at present. Otherwise hook with priority 10. There is some precedent for this; WP post types have a _builtin flag.

Change History (2)

#1 @boonebgorges
13 years ago

jjj and I talked about this and we decided that, at the moment, it's probably best to go with my first suggestion: namely, that we encourage plugin authors to write their own implementations of an include() method. I'll modify BP_Component's inline docs to make this clear, and when I rework the BuddyPress Skeleton Component I'll include some best practices for plugin authors.

#2 @boonebgorges
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5122]) Clarifies how plugins should use BP_Component::includes() in the inline docs. Fixes #3552

Note: See TracTickets for help on using tickets.