• Resolved Garrett Hyder

    (@garrett-eclipse)


    Hello,

    The following is my trail of fixes to resolve an issue where the Organizer wasn’t saving the changes I was making to the Hierarchy Tree.

    I have the following errors when I load the page;

    [09-Jun-2015 18:13:44 UTC] PHP Strict Standards:  Declaration of Walker_Group_Edit::start_lvl() should be compatible with Walker::start_lvl(&$output, $depth = 0, $args = Array) in /home/ljlee/public_html/wp-content/plugins/bp-group-organizer/includes/group-organizer.php on line 183
    [09-Jun-2015 18:13:44 UTC] PHP Strict Standards:  Declaration of Walker_Group_Edit::end_lvl() should be compatible with Walker::end_lvl(&$output, $depth = 0, $args = Array) in /home/ljlee/public_html/wp-content/plugins/bp-group-organizer/includes/group-organizer.php on line 183
    [09-Jun-2015 18:13:44 UTC] PHP Strict Standards:  Declaration of Walker_Group_Edit::start_el() should be compatible with Walker::start_el(&$output, $object, $depth = 0, $args = Array, $current_object_id = 0) in /home/ljlee/public_html/wp-content/plugins/bp-group-organizer/includes/group-organizer.php on line 183

    Looking into it seems like the declaration is incorrect in the Walker_Group_Edit class for these methods; start_lvl, end_lvl & start_el

    So I corrected these as follows;
    function start_lvl(&$output, $depth=0, $args=array()) {}
    function end_lvl(&$output, $depth=0, $args=array()) {
    function start_el(&$output, $item, $depth=0, $args=array(), $current_object_id = 0) {

    But now am getting the following;

    WARNING: wp-content/plugins/bp-group-organizer/includes/group-organizer.php:60 - Creating default object from empty value
    do_action('groups_page_group_organizer'), call_user_func_array, bp_group_organizer_admin_page, bp_get_groups_to_edit, walk_group_tree, call_user_func_array, Walker->walk, Walker->display_element, call_user_func_array, Walker_Group_Edit->start_el

    Which I resolved by creating a new $groups_template object if it doesn’t already exists by placing on line 60 of group-organizer.php;

    if (!is_object($groups_template)) {
    	$groups_template = new BP_Groups_Template();
    }

    Which now leaves me with the following warnings;

    NOTICE: wp-content/plugins/bp-group-organizer/includes/group-organizer.php:176 - Undefined property: stdClass::$object_id
    do_action('groups_page_group_organizer'), call_user_func_array, bp_group_organizer_admin_page, bp_get_groups_to_edit, walk_group_tree, call_user_func_array, Walker->walk, Walker->display_element, call_user_func_array, Walker_Group_Edit->start_el
    NOTICE: wp-content/plugins/bp-group-organizer/includes/group-organizer.php:177 - Undefined property: stdClass::$object
    do_action('groups_page_group_organizer'), call_user_func_array, bp_group_organizer_admin_page, bp_get_groups_to_edit, walk_group_tree, call_user_func_array, Walker->walk, Walker->display_element, call_user_func_array, Walker_Group_Edit->start_el
    NOTICE: wp-content/plugins/bp-group-organizer/includes/group-organizer.php:179 - Undefined property: stdClass::$menu_order
    do_action('groups_page_group_organizer'), call_user_func_array, bp_group_organizer_admin_page, bp_get_groups_to_edit, walk_group_tree, call_user_func_array, Walker->walk, Walker->display_element, call_user_func_array, Walker_Group_Edit->start_el
    NOTICE: wp-content/plugins/bp-group-organizer/includes/group-organizer.php:180 - Undefined property: stdClass::$type
    do_action('groups_page_group_organizer'), call_user_func_array, bp_group_organizer_admin_page, bp_get_groups_to_edit, walk_group_tree, call_user_func_array, Walker->walk, Walker->display_element, call_user_func_array, Walker_Group_Edit->start_el

    To remove these errors I removed some of the hidden menu-item inputs as they don’t have relevant information and are causing the issue;

    <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" />
    <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" />
    <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" />
    <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" />

    *I left the ID and parent_id ones as they had information.

    This left me with this error on the get_tree method;

    [09-Jun-2015 21:11:34 UTC] PHP Strict Standards:  Non-static method BP_Groups_Hierarchy::get_tree() should not be called statically in /home/ljlee/public_html/wp-content/plugins/bp-group-organizer/includes/group-organizer.php on line 198
    [09-Jun-2015 21:11:34 UTC] PHP Strict Standards:  Non-static method BP_Groups_Hierarchy::get_tree() should not be called statically, assuming $this from incompatible context in /home/ljlee/public_html/wp-content/plugins/bp-group-organizer/includes/group-organizer.php on line 78

    I didn’t find a solution or alternate method for get_tree but don’t believe it’s needed as my issue of the Organizer not saving was resolved through my changes, not sure exactly which step… but it’s working now.

    Hope this can get merged into the plugin or at least help someone in the future.

    Cheers

    https://wordpress.org/plugins/bp-group-organizer/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Declaration of Walker_Group_Edit should be compatible with Walker’ is closed to new replies.