WordPress.org

Support

Support » Plugins and Hacks » [Resolved] tree-loop inside member groups list! help-me please.

[Resolved] tree-loop inside member groups list! help-me please.

  • 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/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author David Dean
    Member

    @ddean

    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

    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!
    🙂

    Fee
    Participant

    @wdfee

    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?

    Fee
    Participant

    @wdfee

    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.

    Fee
    Participant

    @wdfee

    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…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] tree-loop inside member groups list! help-me please.’ is closed to new replies.