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

712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
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

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.