Skip to:
Content
Pages
Categories
Search
Top
Bottom

Site_Root group showing all SubGroup updates!

  • Avatar of intrd
    intrd
    Participant

    @intrd

    Hello devs,
    any idea to help-me show all SubGroups Activities at Site_Root stream?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Avatar of intrd
    intrd
    Participant

    @intrd

    Note:
    I do not want to force members of the group root, enter all parentgrpous, like this:

    /* groups_join_group is called whenever someone joins a group in both BP 1.2 and 1.5.x */
    add_action(‘groups_join_group’, ‘my_join_group_action’, 10, 2);

    function my_join_group_action( $group_id, $user_id ) {

    /* This part is critical – you must select ONLY the groups you want to START this chain
    * This function will recurse up to the toplevel on its own, so if you have a parent group
    * in the list, you will waste resources trying to join the same group multiple times
    * as this function is called on each step up the tree
    */
    /** Pick from a list of groups */
    if( in_array( $group_id, ARRAY_OF_GROUPS_I_CARE_ABOUT ) ) {
    /* — OR — */
    /** Select groups by depth */
    if( count( bp_group_hierarchy_get_parents() ) == DEPTH_OF_GROUP_I_CARE_ABOUT_EG_3 ) {
    /* — OR ANYTHING ELSE YOU LIKE */

    /* However you choose to select groups, once the group_id matched this part will
    * walk up the tree, joining the user to each parent group along the way
    */

    $parents = bp_group_hierarchy_get_parents();
    foreach( $parents as $parent_group_id ) {
    groups_join_group( $parent_group_id, $user_id );
    }
    }
    }

    I’m thinking only one way to show all streams of subgroups in a root stream ..
    thanks!

    Avatar of David Dean
    David Dean
    Participant

    @ddean

    @intrd – Site Root isn’t a real group, it’s just a placeholder so you can make new groups top-level.

    If you want group activity to propagate to parent groups, the easiest way is to hook when entries are made and copy them into the parent group. The big problem is that this can make a LOT of duplicate entries depending on the depth of the tree.

    Avatar of intrd
    intrd
    Participant

    @intrd

    Thanks David!
    I’ve solved the problem creating a function to listing all toplevel subgroup ids of that siteroot and putting this list into primary_id value of activity filter..

    $lines=bp_get_all_lines_from_current($bp->groups->current_group->id);
    if ( bp_is_groups_component() ){
    $qs = $qs.”&primary_id=$lines”;
    }

    Avatar of intrd
    intrd
    Participant

    @intrd

    at this point all updates into subgroups propagates to father groups! :)

    Avatar of overloadedtoday
    overloadedtoday
    Member

    @overloadedtoday

    can you please tell me how to do this? I am having the same issues…wanting the subgroups to post in parent groups.

    Avatar of intrd
    intrd
    Participant

    @intrd

    @overloadedtoday i’ve made a function to get all child group_id’s and put it in the query_string..

    …&primary_id=1,14,5,45

    it creates an activity page with only updates inside these groups

    Avatar of needle
    Christian Wach
    Participant

    @needle

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.