Skip to:
Content
Pages
Categories
Search
Top
Bottom

Filtered the Groups – almost – HEEEEEELLLPPP!!!!

  • @vee_bee

    Participant

    OK…
    I am part way to doing some segregation on my site.

    I have managed to filter the Groups, without editing the core files – so far.
    Problem I am now having, is that the bp_has_groups is not working when I choose a group I am not a member of.
    The Groups Directory displays the filtered listing. Go to an individual group, and nothing is displayed.

    Code I am using to filter is:

    function bp_mpo_groups_filter( $a, $groups ) {
    global $bp;
    $current_user = $bp->loggedin_user->id;
    $current_institution = get_usermeta($current_user,"institution");

    if ( is_site_admin() )
    return $groups;

    foreach ( $groups->groups as $key => $group ) {
    if ($current_institutiongroups_get_groupmeta($group->id,"institution")) {
    unset( $groups->groups[$key] );
    $groups->group_count = $groups->group_count-1;
    $groups->total_group_count = $groups->total_group_count-1;
    $groups->pag_num = $groups->pag_num -1;
    }
    }

    /* Renumber the array keys to account for missing items */
    $groups_new = array_values( $groups->groups );
    $groups->groups = $groups_new;
    return $groups;
    }
    add_action( 'bp_has_groups', 'bp_mpo_groups_filter', 10, 2 );

    Anyone have an idea why in both my sidebar widget, and when I try and show a group from the groups directory – I see nothing??
    (Am I even close to doing this the right way?)

    If I succeeed at this, I will release all the files of what I have done to achieve this,
    Thanks in advance.

    V

Viewing 1 replies (of 1 total)
  • @vee_bee

    Participant

    I have tried various other things – but still lost.
    I also hesitate ever bumping a post…

Viewing 1 replies (of 1 total)
  • The topic ‘Filtered the Groups – almost – HEEEEEELLLPPP!!!!’ is closed to new replies.
Skip to toolbar