Updating "Group Component Activity"

Hi, I was wondering if any one could point out how to update a Group Component's Activity in the Group.
It seems simple enough except that my Group Component is a group (I have implemented parent / child) groups.

Just to elaborate:

Parent Groups URLS are like this:

http://domain.com/groups/Parent_Group_Name

In there, there are links to {child_groups}, however when user clicks on the child group link, it still navigates to

http://domain.com/groups/Child_Group_Name.

So, in a nutshell, my "group component" is essentially a group itself. Meaning it has all BP Group functionality including activities.

So my question is, how would I link / update "Child Group" Activity streams in the the "Parent Group" stream.

I have succesfully modified the groups loop to exclude child groups from showing up in the results. (Only Parent Groups are returned if a Child Group is found).

I tried modifying the activities loop to include child group activities in a parent group loop but my method will mean I would have to rewrite the template tags!

Any one have any experience with this?

The groups loop works brilliantly:

<?php do_action( 'bp_before_groups_loop' ) ?>

<?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) >

<ul id="groups-list" class="item-list">
<?php
// get all the ids of all the groups
global $groups_template, $bp; $group_ids = custom_group_type::get_current_group_ids();

foreach( $groups_template->groups as $group ):

//check if child group - )
// function is_child_group() returns parent group id if true or false if not.

if( $parent_group_id = custom_group_type::is_child_group( $group->id ) )
{
//remove the child group so it doesn't appear in the main groups loop
unset( $group );

// Check if parent group is already in the loop
if( in_array( $parent_group_id, $group_ids ) )
{
continue;
}
else
{
// if the parent group is not in the loop, initiate it and display it.
$parent_group = groups_get_group( array( 'group_id' => $parent_group_id ) );

?>

  • <div class="item-avatar">
    ">
    <?= get_group_avatar_by_group( $parent_group, 'type=thumb&width=50&height=50' ) ?>

    </div>

    <div class="item">
    <div class="item-title">
    <h3>">
    <?= bp_get_group_name( $parent_group ) ?>
    </h3>
    </div>
    <div class="item-meta">
    <span class="activity">
    <?php printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active( $parent_group ) ) ?>
    </span>
    </div>

    <div class="item-desc"><?= bp_get_group_description_excerpt( $parent_group ) ?></div>

    <?php do_action( 'bp_directory_groups_item', $parent_group->id ) ?>
    </div>

    <div class="action">
    <?= bp_get_group_join_button( $parent_group ) ?>

    <div class="meta">
    <?= bp_get_group_type( $parent_group ) ?> / <?= bp_get_group_member_count( $parent_group ) ?>
    </div>

    <?php do_action( 'bp_directory_groups_actions', $group->id ) ?>
    </div>

    <div class="clear"></div>

  • <?php
    }
    }
    // continue with the normal loop
    else
    {
    ?>

  • <div class="item-avatar">
    ">
    <?= get_group_avatar_by_group( $group, 'type=thumb&width=50&height=50' ) ?>

    </div>

    <div class="item">
    <div class="item-title">
    <h3>">
    <?= bp_get_group_name( $group ) ?>
    </h3>
    </div>
    <div class="item-meta">
    <span class="activity">
    <?php printf( __( 'active %s ago', 'buddypress' ), bp_get_group_last_active( $group ) ) ?>
    </span>
    </div>

    <div class="item-desc"><?= bp_get_group_description_excerpt( $group ) ?></div>

    <?php do_action( 'bp_directory_groups_item', $group->id ) ?>
    </div>

    <div class="action">
    <?= bp_get_group_join_button( $group ) ?>

    <div class="meta">
    <?= bp_get_group_type( $group ) ?> / <?= bp_get_group_member_count( $group ) ?>
    </div>

    <?php do_action( 'bp_directory_groups_actions', $group->id ) ?>
    </div>

    <div class="clear"></div>

  • <?php

    }
    endforeach; ?>

    <?php do_action( 'bp_after_groups_loop' ) ?>

    <?php else: ?>

    <div id="message" class="info">
    <p><?php _e( 'There were no groups found.', 'buddypress' ) ?></p>
    </div>

    <?php endif; ?>