Skip to:
Content

Opened 4 months ago

Closed 7 weeks ago

Last modified 7 weeks ago

#5287 closed enhancement (fixed)

add a column to BP_Groups_List_Table

Reported by: shanebp Owned by: 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 4 months ago.
custom-column.png (76.0 KB) - added by imath 4 months ago.
5287.02.diff (1.6 KB) - added by imath 7 weeks ago.

Download all attachments as: .zip

Change History (12)

comment:1 shanebp4 months ago

  • Cc shane@… added

comment:2 imath4 months 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 );

imath4 months ago

imath4 months ago

comment:3 shanebp4 months ago

Thanks @imath

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

comment:4 boonebgorges4 months 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.

comment:5 DJPaul7 weeks 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.

imath7 weeks ago

comment:6 imath7 weeks ago

  • Keywords needs-refresh removed

refreshed ;)

comment:7 DJPaul7 weeks ago

  • Keywords commit added

Haven't tested but patch looks fine! +1

comment:8 imath7 weeks 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

comment:9 shanebp7 weeks 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.