BP_Groups_List_Table::column_comment( array $item = array() )
Name column, and “quick admin” rollover actions.
Description
Called "comment" in the CSS so we can re-use some WP core CSS.
See also
Parameters
- $item
-
(Optional) A singular item (one full row).
Default value: array()
Source
File: bp-groups/classes/class-bp-groups-list-table.php
public function column_comment( $item = array() ) {
// Preorder items: Edit | Delete | View.
$actions = array(
'edit' => '',
'delete' => '',
'view' => '',
);
// We need the group object for some BP functions.
$item_obj = (object) $item;
// Build actions URLs.
$base_url = bp_get_admin_url( 'admin.php?page=bp-groups&gid=' . $item['id'] );
$delete_url = wp_nonce_url( $base_url . "&action=delete", 'bp-groups-delete' );
$edit_url = $base_url . '&action=edit';
$view_url = bp_get_group_permalink( $item_obj );
/**
* Filters the group name for a group's column content.
*
* @since BuddyPress 1.7.0
*
* @param string $value Name of the group being rendered.
* @param array $item Array for the current group item.
*/
$group_name = apply_filters_ref_array( 'bp_get_group_name', array( $item['name'], $item ) );
// Rollover actions.
// Edit.
$actions['edit'] = sprintf( '<a href="%s">%s</a>', esc_url( $edit_url ), __( 'Edit', 'buddyboss' ) );
// Delete.
$actions['delete'] = sprintf( '<a href="%s">%s</a>', esc_url( $delete_url ), __( 'Delete', 'buddyboss' ) );
// Visit.
$actions['view'] = sprintf( '<a href="%s">%s</a>', esc_url( $view_url ), __( 'View', 'buddyboss' ) );
/**
* Filters the actions that will be shown for the column content.
*
* @since BuddyPress 1.7.0
*
* @param array $value Array of actions to be displayed for the column content.
* @param array $item The current group item in the loop.
*/
$actions = apply_filters( 'bp_groups_admin_comment_row_actions', array_filter( $actions ), $item );
// Get group name and avatar.
$avatar = '';
if ( buddypress()->avatar->show_avatars ) {
$avatar = bp_core_fetch_avatar( array(
'item_id' => $item['id'],
'object' => 'group',
'type' => 'thumb',
'avatar_dir' => 'group-avatars',
'alt' => sprintf( __( 'Group logo of %s', 'buddyboss' ), $group_name ),
'width' => '32',
'height' => '32',
'title' => $group_name
) );
}
$content = sprintf( '<strong><a href="%s">%s</a></strong>', esc_url( $edit_url ), $group_name );
echo $avatar . ' ' . $content . ' ' . $this->row_actions( $actions );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.7.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.