Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/06/2016 07:55:32 AM (4 years ago)
Author:
r-a-y
Message:

Groups Admin: Better support for multiple group types.

If more than one group type is registered:

  • When editing a group, you can now set multiple group types for that group.
  • When viewing the Groups admin dashboard, all group types for a group are displayed in the "Group Type" column.

See #7210.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/classes/class-bp-groups-list-table.php

    r11162 r11176  
    716716        }
    717717
    718         // Get the group type.
    719         $type = bp_groups_get_group_type( $item['id'] );
    720 
    721         // Output the
    722         if ( $type_obj = bp_groups_get_group_type_object( $type ) ) {
    723             $url         = add_query_arg( array( 'bp-group-type' => urlencode( $type ) ) );
    724             $retval = '<a href="' . esc_url( $url ) . '">' . esc_html( $type_obj->labels['singular_name'] ) . '</a>';
    725         }
     718        add_filter( 'bp_get_group_type_directory_permalink', array( $this, 'group_type_permalink_use_admin_filter' ), 10, 2 );
     719        $retval = bp_get_group_type_list( $item['id'], array(
     720            'parent_element' => '',
     721            'label_element'  => '',
     722            'label'          => '',
     723            'show_all'       => true
     724        ) );
     725        remove_filter( 'bp_get_group_type_directory_permalink', array( $this, 'group_type_permalink_use_admin_filter' ), 10, 2 );
    726726
    727727        /**
     
    734734         */
    735735        echo apply_filters_ref_array( 'bp_groups_admin_get_group_type_column', array( $retval, $item ) );
     736    }
     737
     738    /**
     739     * Filters the group type list permalink in the Group Type column.
     740     *
     741     * Changes the group type permalink to use the admin URL.
     742     *
     743     * @since 2.7.0
     744     *
     745     * @param  string $retval Current group type permalink.
     746     * @param  object $type   Group type object.
     747     * @return string
     748     */
     749    public function group_type_permalink_use_admin_filter( $retval, $type ) {
     750        return add_query_arg( array( 'bp-group-type' => urlencode( $type->name ) ) );
    736751    }
    737752
Note: See TracChangeset for help on using the changeset viewer.