Skip to:
Content

BuddyPress.org

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5287 closed enhancement (fixed)

add a column to BP_Groups_List_Table

Reported by: shanebp's profile shanebp Owned by: imath's profile imath
Milestone: 2.0 Priority: normal
Severity: normal Version:
Component: Groups Keywords: has-patch commit
Cc: shane@…

Description

It would be very useful to add the ability to add a custom column and fill that column per row in BP_Groups_List_Table.

It would require a do_action_ref_array filter in
function get_columns()

And maybe a filter in
function single_row()
so we can populate that column per row ?

Might have to override function single_row_columns() ?

You get the idea...

Following on would be the ability to integrate custom fields / options in
function bp_groups_admin_edit()
for the single group screen.
Would it be possible to use a template for that screen ?

The recent update of Group_Extension_API was very helpful.

But the ability to integrate data (from extensions or otherwise) in the DashBoard > Groups screens would fill a big gap in arguably the most attractive part of BP - Groups ( at least for my clients ).

Attachments (3)

5287.diff (1.5 KB) - added by imath 11 years ago.
custom-column.png (76.0 KB) - added by imath 11 years ago.
5287.02.diff (1.6 KB) - added by imath 11 years ago.

Download all attachments as: .zip

Change History (12)

#1 @shanebp
11 years ago

  • Cc shane@… added

#2 @imath
11 years ago

  • Keywords has-patch 2nd-opinion added

Hi @shanebp, i will reply on the first part of your request.

To allow plugins adding a custom column to the Administration Groups List table, i suggest 5287.diff. I've also added a screencap (custom-column.png) of the result of these two example filters plugins can use :

// Name for the column
function shanebp_add_column( $columns = array() ) {
	$columns['shanebp_custom'] = 'Group ID';
	return $columns;
}

add_filter( 'bp_groups_list_table_get_columns', 'shanebp_add_column', 10, 1 );

//Content for each group
function shanebp_fill_group_row( $data = '', $column_name = '', $item = array() ) {
	$group_id = $item['id'];

	if( 'shanebp_custom' == $column_name ) 
		$data = $group_id;

	return $data;
}

add_filter( 'bp_groups_admin_get_group_custom_column', 'shanebp_fill_group_row', 10, 3 );

@imath
11 years ago

@imath
11 years ago

#3 @shanebp
11 years ago

Thanks @imath

Core devs: would you like me to make a separate ticket re the single group screen ?

#4 @boonebgorges
11 years ago

  • Component changed from Core to Groups
  • Keywords 2nd-opinion removed
  • Milestone changed from Awaiting Review to 2.0

This seems like a reasonable request. Would be nice if there were a more elegant way, but that's WP_List_Table's fault.

shanebp - It's already possible to add meta boxes to single group screens, using the regular meta box API. Look at how BP does it in bp-groups/bp-groups-admin.php.

#5 @DJPaul
11 years ago

  • Keywords needs-refresh added

I don't think we need to use apply_filters_ref_array (we can just use normal apply_filters) but the patch looks OK to be updated then committed.

@imath
11 years ago

#6 @imath
11 years ago

  • Keywords needs-refresh removed

refreshed ;)

#7 @DJPaul
11 years ago

  • Keywords commit added

Haven't tested but patch looks fine! +1

#8 @imath
11 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 8051:

Introduce new filters to add a custom column to BP_Groups_List_Table()

In Group Administration screen, plugins/themes can now use these filters to add a custom column to the groups list table.

Props shanebp

Fixes #5287

#9 @shanebp
11 years ago

Props shanebp

lol, rather, props imath, who has been one busy beaver in trac.

also - the whole groups admin interface is great and very extensible - appreciation !

Note: See TracTickets for help on using tickets.