BBP_Topics_Admin::column_data( string $column, int $topic_id )
Print extra columns for the topics page
Description
Parameters
- $column
-
(Required) Column
- $topic_id
-
(Required) Topic id
Source
File: bp-forums/admin/topics.php
public function column_data( $column, $topic_id ) { if ( $this->bail() ) return; // Get topic forum ID $forum_id = bbp_get_topic_forum_id( $topic_id ); // Populate column data switch ( $column ) { // Forum case 'bbp_topic_forum' : // Output forum name if ( !empty( $forum_id ) ) { // Forum Title $forum_title = bbp_get_forum_title( $forum_id ); if ( empty( $forum_title ) ) { $forum_title = esc_html__( 'No Forum', 'buddyboss' ); } // Output the title echo $forum_title; } else { esc_html_e( '(No Forum)', 'buddyboss' ); } break; // Reply Count case 'bbp_topic_reply_count' : bbp_topic_reply_count( $topic_id ); break; // Reply Count case 'bbp_topic_voice_count' : bbp_topic_voice_count( $topic_id ); break; // Author case 'bbp_topic_author' : bbp_topic_author_display_name( $topic_id ); break; // Freshness case 'bbp_topic_created': printf( '%1$s <br /> %2$s', get_the_date(), esc_attr( get_the_time() ) ); break; // Freshness case 'bbp_topic_freshness' : $last_active = bbp_get_topic_last_active_time( $topic_id, false ); if ( !empty( $last_active ) ) { echo esc_html( $last_active ); } else { esc_html_e( 'No Replies', 'buddyboss' ); // This should never happen } break; // Do an action for anything else default : do_action( 'bbp_admin_topics_column_data', $column, $topic_id ); break; } }
Changelog
Version | Description |
---|---|
bbPress (r2485) | 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.