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

	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.