[buddypress-trac] [BuddyPress Trac] #7140: Class autoloading needs to check if the component is active before including the class

buddypress-trac noreply at wordpress.org
Fri Jun 24 22:54:57 UTC 2016


#7140: Class autoloading needs to check if the component is active before
including the class
--------------------------+--------------------
 Reporter:  r-a-y         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  2.6.1
Component:  Core          |     Version:  2.6.0
 Severity:  major         |  Resolution:
 Keywords:  has-patch     |
--------------------------+--------------------

Comment (by dcavins):

 Ha ha, I'm sure some of those on github are mine, based on the examples in
 Ye Olde Skeleton Plugin sample plugin (maybe we should update that to
 reflect the modern state of things?), and on examples in our own Codex:
 https://codex.buddypress.org/developer/group-extension-api/

 I'm not sure that calling that "bad code" is fair. It was accurate and was
 a reasonable safety net, right up until we started autoloading, ha ha.

 I'll fix those examples in the Codex. So do we want to recommend doing
 both checks:
 `if ( bp_is_active( 'groups' ) && class_exists( 'BP_Group_Extension' ) )
 {}`
 or are we recommending that
 `if ( bp_is_active( 'groups' ) ) {}`
 is sufficient? (Group Extension class was apparently part of BP 1.1
 (amazing!) and was massively updated for 1.8, so...)

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7140#comment:8>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list