WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use the example code found at http://codex.buddypress.org/developer-docs/group-extension-api/ to use in a plugin, but when I try to use it I keep getting the following error:

Fatal error: Class 'BP_Group_Extension' not found in /home/httpd/html/wearewomenmarch.net/public_html/wp-content/plugins/buddypress-group-documents/index.php on line 53

The line 53 in question is as follows:

class BP_Group_Document_List_Extension extends BP_Group_Extension {  

And the whole chunk of code I'm trying to use is

class BP_Group_Document_List_Extension extends BP_Group_Extension {  
var $visibility = 'private';
var $enable_create_step = false;
var $enable_nav_item = false;
var $enable_edit_item = false;

function bp_group_document_list_extension() {
        $this->name = 'Documents List';
        $this->slug = 'group-document-list';

        $this->create_step_position = 21;
        $this->nav_item_position = 31;

    function create_screen() { }

    function create_screen_save() { }

    function edit_screen() {  }

    function edit_screen_save() { }

    function display() {

    function widget_display() {  }
bp_register_group_extension( 'BP_Group_Document_List_Extension' );

Groups are active on the site, and the BP Group Calendar plugin is active. I see it uses the Group Extension API as well and it works, so I'm sure I'm making some mistake. I'd appreciate any advice on where to go from here so I can resolve that fatal error.

share|improve this question

closed as off-topic by Pieter Goosen, kaiser Aug 4 '14 at 16:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – Pieter Goosen, kaiser
If this question can be reworded to fit the rules in the help center, please edit the question.

You can get this fatal error if you plugin is loaded before BuddyPress, if you're creating extension for BuddyPress, first you should check if BuddyPress is active and loaded, here is suggested method from BP Codex.

Plugin Name: My Plugin
Plugin URI: http://example.org/my-plugin/
Description: My BuddyPress plugin
Version: 1.0
Requires at least: WordPress 2.9.1 / BuddyPress 1.2
Tested up to: WordPress 2.9.1 / BuddyPress 1.2
License: GNU/GPL 2
Author: Some Person
Author URI: http://example.org/me/

/* Only load code that needs BuddyPress to run once BP is loaded and initialized. */
function my_plugin_init() {
    require( dirname( __FILE__ ) . '/my-plugin.php' );
add_action( 'bp_include', 'my_plugin_init' );

/* If you have code that does not need BuddyPress to run, then add it here. */

Source: Checking For BuddyPress

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.