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

Print extra columns for the replies page


Description Description


Parameters Parameters

$column

(Required) Column

$reply_id

(Required) reply id


Top ↑

Source Source

File: includes/admin/replies.php

	public function column_data( $column, $reply_id ) {

		// Get topic ID
		$topic_id = bbp_get_reply_topic_id( $reply_id );

		// Populate Column Data
		switch ( $column ) {

			// Topic
			case 'bbp_reply_topic' :

				// Get title
				$topic_title = ! empty( $topic_id )
					? bbp_get_topic_title( $topic_id )
					: '';

				// Output topic name
				if ( ! empty( $topic_title ) ) {
					echo $topic_title;

				// Output dash
				} else {
					?>
					<span aria-hidden="true">&mdash;</span>
					<span class="screen-reader-text"><?php esc_html_e( 'No topic', 'bbpress' ); ?></span>
					<?php
				}

				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 );

				// Forum Title
				$forum_title = ! empty( $reply_forum_id )
					? bbp_get_forum_title( $reply_forum_id )
					: '';

				// 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', $reply_id ) ) {
						$forum_title .= '<div class="attention">' . esc_html__( '(Mismatch)', 'bbpress' ) . '</div>';
					}
				}

				// Output forum name
				if ( ! empty( $forum_title ) ) {
					echo $forum_title;

				// Reply has no forum
				} else {
					?>
					<span aria-hidden="true">&mdash;</span>
					<span class="screen-reader-text"><?php esc_html_e( 'No forum', 'bbpress' ); ?></span>
					<?php
				}

				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;
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.