Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Group Component Activity


Jason Nathan
Participant

@jasonnathan

The groups loop works brilliantly:
`

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

    <?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 ) );

    ?>

  • <a href="”>

    <a href="”>

    id ) ?>

    /

    id ) ?>

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

  • <a href="”>

    <a href="”>

    id ) ?>

    /

    id ) ?>

  • <?php

    }
    endforeach; ?>

`

Skip to toolbar