Jump to content

Recommended Posts

Hi, does anyone have a clue how to fix the following error.

Warning: Creating default object from empty value in C:\XAMPP\htdocs\hidden\wp-content\plugins\bp-group-hierarchy\bp-group-hierarchy-actions.php on line 22

 

It's caused by this piece of code.

function bp_group_hierarchy_setup_globals()
{
global $bp, $wpdb;
/* For internal identification */
$bp->group_hierarchy->id = 'group_hierarchy'; // line 22
$bp->group_hierarchy->table_name = $wpdb->base_prefix . 'bp_group_hierarchy';
$bp->group_hierarchy->slug = BP_GROUP_HIERARCHY_SLUG;

/* Register this in the active components array */
$bp->active_components[$bp->group_hierarchy->slug] = $bp->group_hierarchy->id;

do_action('bp_group_hierarchy_globals_loaded');
}

 

That is from BuddyPress. I have nothing to do with that code.

Edited by Stylock

It is just saying that it is not an object, you can solve it by defining it as a stdClass:

 

function bp_group_hierarchy_setup_globals()
{
global $bp, $wpdb;

/* Define a default class if one has not been instantiated */
if (!is_object($bp->group_hierarchy)) 
    $bp->group_hierarchy = new stdClass();

/* For internal identification */
$bp->group_hierarchy->id = 'group_hierarchy'; // line 22
$bp->group_hierarchy->table_name = $wpdb->base_prefix . 'bp_group_hierarchy';
$bp->group_hierarchy->slug = BP_GROUP_HIERARCHY_SLUG;

/* Register this in the active components array */
$bp->active_components[$bp->group_hierarchy->slug] = $bp->group_hierarchy->id;

do_action('bp_group_hierarchy_globals_loaded');
}

 

And that should get rid of the warnings. 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.