WordPress.org

Ready to get started?Download WordPress

Forums

BP Group Hierarchy
[resolved] tree-loop inside member groups list! help-me please. (6 posts)

  1. intrd
    Member
    Posted 1 year ago #

    Hello, Hierarchy is a great plugin, thanks!

    I'm trying to put group tree inside member groups list, like this shot:
    http://humorzao.com.br/problem.jpg

    i've put the code:

    <div id="groups-dir-list" class="groups dir-list">
    			<?php
    				$loop_template = apply_filters('bp_located_template',locate_template( array( "tree/tree-loop_single.php" ), false ), "tree/tree-loop_single.php" );
    				load_template($loop_template);
    			?>
    </div><!-- #groups-dir-list -->

    and loaded the css + js of hierarchy at header.
    its works, but not listing child groups when i click at [+], always list the current group!

    i think the problem is bp_ajax_querystring( 'tree' ), but i cant figure it out..
    can you helpme?
    what i need to change to display correct child groups?

    thanks!
    you plugin is awesome.

    http://wordpress.org/extend/plugins/bp-group-hierarchy/

  2. David Dean
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, intrd -

    First I'd check to be sure the JS is sending the object parameter as 'tree' or that function won't fire at all.

    Also check that the scope parameter is 'childof_[selected group ID]'. That controls whose subgroups are returned.

    If neither of those bears any fruit, check out bp_group_hierarchy_display and bp_group_hierarchy_get_groups_tree in extension.php to try debugging.

    Please let me know if you have any other questions!

    - Davi

  3. intrd
    Member
    Posted 1 year ago #

    Thanks Dean!
    i've done!

    first into extension.php i've removed the:

    bp_has_groups_hierarchy(array(
    			'type'		=> 'alphabetical',
    			'parent_id'	=> $bp->groups->current_group->id,
    			'page'		=> $page
    		));

    second, at the tree-loop.php, i've removed the old loop bp_has_groups(bp_ajax_querystring( 'tree' )) and replaced with:

    bp_has_groups_hierarchy(array(
    				'type'		=> 'alphabetical',
    				'parent_id'	=> $qd,
    				'page'		=> $page
    ));

    my $qd is the current ajax(bp_ajax_querystring( 'tree' )) clicked group_id!

    i'm not sure if its the right way.. bu worked like a charm..

    very thx!
    :)

  4. Fee
    Member
    Posted 1 year ago #

    Hello,
    I'd need this feature, too. Usually I don't like to hardcode plugin files, that I can go on updating easily. Would you mind to either implement this into your plugin or offer some hooks, that this could be added from another plugin or theme?

  5. Fee
    Member
    Posted 1 year ago #

    I tried now the harcoding way of intrd, but it doesn't work.
    @intrd what do you mean with removing the bp_has_groups_hierarchy... code? That doesn't make sense, no groups are queried anymore.
    If I replace the bp_has_groups inside of tree-loop.php, it's always showing all groups, not only the child groups of the current/selected group.

  6. Fee
    Member
    Posted 1 year ago #

    ok, much more simple as I thought...

    Just replace in tree-loop.php the bp_has_groups( bp_ajax_querystring( 'tree' ) ) with bp_has_groups_hierarchy( bp_ajax_querystring( 'tree' ) ).

    In extension.php it can stay the way it is. Despite the file loading, I just changed in line 853:
    } else if(bp_is_groups_component() && $bp->current_action == '' && $bp->group_hierarchy->extension_settings['show_group_tree']) {
    to
    } else if(bp_is_groups_component() && ($bp->current_action == '' || $bp->current_action == 'hierarchy') && $bp->group_hierarchy->extension_settings['show_group_tree']) {

    It would be nice if the loop wouldn't be hardcoded in extensions.php, but as a template file, ready for overriding...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic