wppaste
WordPress

WP_Comments_List_Table

Since
3.1.0
Source
wp-admin/includes/class-wp-comments-list-table.php:17
Core class used to implement displaying comments in a list table.

Compatibility

WordPress
since 3.1.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 10

Every hook that fires from inside WP_Comments_List_Table, in the order it appears in the class, grouped by the method that fires it.

Properties · 4

$checkboxpublic
$pending_countpublic
$extra_itemspublic
$user_canprivate

Methods · 23

Source code

class WP_Comments_List_Table extends WP_List_Table { 	public $checkbox = true; 	public $pending_count = array(); 	public $extra_items; 	private $user_can; 	/**	 * Constructor.	 *	 * @since 3.1.0	 *	 * @see WP_List_Table::__construct() for more information on default arguments.	 *	 * @global int $post_id	 *	 * @param array $args An associative array of arguments.	 */	public function __construct( $args = array() ) {		global $post_id; 		$post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0; 		if ( get_option( 'show_avatars' ) ) {			add_filter( 'comment_author', array( $this, 'floated_admin_avatar' ), 10, 2 );		} 		parent::__construct(			array(				'plural'   => 'comments',				'singular' => 'comment',				'ajax'     => true,				'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,			)		);	} 	/**	 * Adds avatars to comment author names.	 *	 * @since 3.1.0	 *	 * @param string $name       Comment author name.	 * @param int    $comment_id Comment ID.	 * @return string Avatar with the user name.	 */	public function floated_admin_avatar( $name, $comment_id ) {		$comment = get_comment( $comment_id );		$avatar  = get_avatar( $comment, 32, 'mystery' );		return "$avatar $name";	} 	/**	 * @return bool	 */	public function ajax_user_can() {		return current_user_can( 'edit_posts' );	} 	/**	 * @global string $mode           List table view mode.	 * @global int    $post_id	 * @global string $comment_status	 * @global string $comment_type	 * @global string $search	 */	public function prepare_items() {		global $mode, $post_id, $comment_status, $comment_type, $search; 		if ( ! empty( $_REQUEST['mode'] ) ) {			$mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';			set_user_setting( 'posts_list_mode', $mode );		} else {			$mode = get_user_setting( 'posts_list_mode', 'list' );		} 		$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';

Changelog

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/class-wp-comments-list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.