Skip to:

Buddypress Group Extension API Not Working

  • ethanstein


    I guess I’m doing something wrong because I copied the content of directly into my custom plugin and it doesn’t seem to do anything. Other components of my plugin that interact with actions like group_join_group work perfectly, but this does not. I want to add the ability to assign a current group as a parent to another (similar to the way Groups Heriarchy plugin worked before). But it doesn’t appear on the Groups –> Edit Group option or even the Add New wizard. What am I doing wrong?

    I tried copying that example into bp-custom.php but it complain about not understanding bp_is_active. Please help.


Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @ethanstein-

    If you’re just looking for a replacement for BP Group Hierarchy, try this:

    If you’re wanting help with your specific use of the group extension api, you’ll need to post the code somewhere we can see it, like a Github gist or similar.



    Yes, definitely helpful. Any idea how to implement the solution within the groups index page as a bulk option as oppose to having to go into the individual group?

    I tried using wordpress’s bulk admin similar to the example pertaining to load-users.php, but it isn’t working.

    add_filter( 'handle_bulk_actions-toplevel_page_bp-groups', 'add_bpgroups_to_bpgroup', 10, 3 );
    function add_bpgroups_to_bpgroup($redirect_to, $doaction, $group_ids) {
        if( bp_is_active('groups') ):
          if ( $doaction !== 'assign_parent_group' ) {
              return $redirect_to;
          $redirect_to = add_query_arg( 'groups_assigned' , implode(',', $group_ids) , $redirect_to );
        return $redirect_to;
    add_filter( 'bulk_actions-toplevel_page_bp-groups', 'register_bulk_assign_parent_action' );
    function register_bulk_assign_parent_action ($bulk_actions) {
     $bulk_actions['assign_parent_group'] = __( 'Assign Parent Group', 'assign_parent_group');
     //form submission
     add_action( 'admin_footer', function() { ?>
         <script type="text/javascript" charset="utf-8">
                 if(jQuery("select[name='action'] :selected").val()=="assign_parent_group") { e.preventDefault();
                     gid=prompt("Enter a Group ID","1");
                     if (gid != null) {
                       jQuery(".wrap form").append('<input type="hidden" name="bp_gid" value="'+gid+'" />').submit();
     return $bulk_actions;
    add_action( 'admin_notices', 'bulk_assign_parent_action_admin_notice' );
    function bulk_assign_parent_action_admin_notice() {
      if ( ! empty( $_REQUEST['groups_assigned'] ) && ! empty( $_REQUEST['assigned_group'] ) ) {
        $groups_assigned =  $_REQUEST['groups_assigned'] ;
        $parent_id = $_REQUEST['assigned_group'];
        $parent_group = groups_get_group($parent_id);
        if ($parent_group->id == 0) {
          printf( '<div id="message" class="error">Unknown group ID %s</div>', $parent_id);
        $group_ids = explode(',' , $groups_assigned);
        foreach ($group_ids as $group_id) {
          $group = groups_get_group( $group_id );
          if (false === groups_edit_group_settings($group_id, $group->enable_forum, $group->status, false, $parent_id )) {
            printf( '<div id="message" class="error">Failed to add group %s to %s.</div>', $group->name, $parent_group->name);
        printf( '<div id="message" class="updated fade">Successfully ' .
          _n( 'assigned %s group',
            'assigned %s groups',
          ) . 'to %s</div>', $groups_assigned, $group_name );

    It fires the
    add_filter( ‘bulk_actions-toplevel_page_bp-groups’, ‘register_bulk_assign_parent_action’ );

    correctly but seems to completely ignore

    add_filter( ‘handle_bulk_actions-toplevel_page_bp-groups’, ‘add_bpgroups_to_bpgroup’, 10, 3 );

    Any ideas?

    No, I don’t, but it’s an interesting idea.

    We’ve been talking about adding a “bulk edit” facility to the group admin pane in wp-admin, but it’s pretty pie-in-the-sky at the moment.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar