Stylock Posted January 16, 2013 Share Posted January 16, 2013 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. Link to comment https://forums.phpfreaks.com/topic/273230-warning-creating-default-object-from-empty-value/ Share on other sites More sharing options...
premiso Posted January 16, 2013 Share Posted January 16, 2013 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. Link to comment https://forums.phpfreaks.com/topic/273230-warning-creating-default-object-from-empty-value/#findComment-1406147 Share on other sites More sharing options...
Stylock Posted January 17, 2013 Author Share Posted January 17, 2013 Thanks! That removed the warning. Link to comment https://forums.phpfreaks.com/topic/273230-warning-creating-default-object-from-empty-value/#findComment-1406362 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.