BBP_Replies_Admin::column_data( string $column, int $reply_id )

Print extra columns for the replies page

Description

Parameters

$column

(Required) Column

$reply_id

(Required) reply id

Source

File: bp-forums/admin/replies.php

659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
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
public function column_data( $column, $reply_id ) {
 
    if ( $this->bail() ) return;
 
    // Get topic ID
    $topic_id = bbp_get_reply_topic_id( $reply_id );
 
    // Populate Column Data
    switch ( $column ) {
 
        // Topic
        case 'bbp_reply_topic' :
 
            // Output forum name
            if ( !empty( $topic_id ) ) {
 
                // Discussion Title
                $topic_title = bbp_get_topic_title( $topic_id );
                if ( empty( $topic_title ) ) {
                    $topic_title = esc_html__( 'No Discussion', 'buddyboss' );
                }
 
                // Output the title
                echo $topic_title;
 
            // Reply has no topic
            } else {
                esc_html_e( 'No Discussion', 'buddyboss' );
            }
 
            break;
 
        // Forum
        case 'bbp_reply_forum' :
 
            // Get Forum ID's
            $reply_forum_id = bbp_get_reply_forum_id( $reply_id );
            $topic_forum_id = bbp_get_topic_forum_id( $topic_id );
 
            // Output forum name
            if ( !empty( $reply_forum_id ) ) {
 
                // Forum Title
                $forum_title = bbp_get_forum_title( $reply_forum_id );
                if ( empty( $forum_title ) ) {
                    $forum_title = esc_html__( 'No Forum', 'buddyboss' );
                }
 
                // Alert capable users of reply forum mismatch
                if ( $reply_forum_id !== $topic_forum_id ) {
                    if ( current_user_can( 'edit_others_replies' ) || current_user_can( 'moderate' ) ) {
                        $forum_title .= '<div class="attention">' . esc_html__( '(Mismatch)', 'buddyboss' ) . '</div>';
                    }
                }
 
                // Output the title
                echo $forum_title;
 
            // Reply has no forum
            } else {
                _e( 'No Forum', 'buddyboss' );
            }
 
            break;
 
        // Author
        case 'bbp_reply_author' :
            bbp_reply_author_display_name ( $reply_id );
            break;
 
        // Freshness
        case 'bbp_reply_created':
 
            // Output last activity time and date
            printf( '%1$s <br /> %2$s',
                get_the_date(),
                esc_attr( get_the_time() )
            );
 
            break;
 
        // Do action for anything else
        default :
            do_action( 'bbp_admin_replies_column_data', $column, $reply_id );
            break;
    }
}

Changelog

Changelog
Version Description
bbPress (r2577) 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.