PUM_Admin_Subscribers_Table::prepare_items()

Prepares the list of items for displaying.


Description Description


Source Source

File: classes/Admin/Subscribers/Table.php

	public function prepare_items() {
		$this->_column_headers = $this->get_column_info();

		// check and process any actions such as bulk actions.
		$this->handle_table_actions();

		$limit = $this->get_items_per_page( 'pum_subscribers_per_page' );

		$query_args = array(
			's'       => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : null,
			'limit'   => $limit,
			'page'    => $this->get_pagenum(),
			'orderby' => isset( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : null,
			'order'   => isset( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : null,
		);

		$this->items = PUM_DB_Subscribers::instance()->query( $query_args, 'ARRAY_A' );

		$total_subscribers = PUM_DB_Subscribers::instance()->total_rows( $query_args );

		$this->set_pagination_args( array(
			'total_items' => $total_subscribers,
			'per_page'    => $limit,
			'total_pages' => ceil( $total_subscribers / $limit ),
		) );
	}


Top ↑

User Contributed Notes User Contributed Notes

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