public/wordpress/wp-content/plugins/wp-courseware/includes/controllers/units.php
/**
	 * Post Type Permission Filter Change Count.
	 *
	 * @since 4.4.0
	 *
	 * @param array $views The views array.
	 */
Post Type Permission Filter Change Count.

@param array $views The views array.
Post Type Permission Filter Change Count . @param array $views The views array .
public function post_type_permission_filter_change_count( $views ) {
		global $wpdb;
		$current_user = wp_get_current_user();
		$post_type = $this->post_type_slug;
		$all = $wpdb->get_var(
			"SELECT COUNT(*) 
		     FROM $wpdb->posts 
		     WHERE ( post_status = 'publish' OR post_status = 'draft' ) 
		     AND ( post_author = '$current_user->ID' AND post_type = '$post_type' )"
		);
		if ( isset( $views['mine'] ) ) {
			$mine = $wpdb->get_var(
				"SELECT COUNT(*) FROM $wpdb->posts 
                 WHERE post_status = 'publish' 
                 AND post_author = '$current_user->ID' 
                 AND post_type = '$post_type'"
			);
		}
		$publish = $wpdb->get_var(
			"SELECT COUNT(*) 
             FROM $wpdb->posts 
             WHERE post_status = 'publish' 
             AND post_author = '$current_user->ID' 
             AND post_type = '$post_type' "
		);
		if ( isset( $views['draft'] ) ) {
			$draft = $wpdb->get_var(
				"SELECT COUNT(*) 
                 FROM $wpdb->posts 
                 WHERE post_status = 'draft' 
                 AND post_author = '$current_user->ID' 
                 AND post_type = '$post_type'"
			);
		}
		if ( isset( $views['all'] ) ) {
			$views['all'] = preg_replace( '/\(.+\)/U', '(' . $all . ')', $views['all'] );
		}
		if ( isset( $views['mine'] ) ) {
			$views['mine'] = preg_replace( '/\(.+\)/U', '(' . $mine . ')', $views['mine'] );
		}
		if ( isset( $views['publish'] ) ) {
			$views['publish'] = preg_replace( '/\(.+\)/U', '(' . $publish . ')', $views['publish'] );
		}
		if ( isset( $views['draft'] ) ) {
			$views['draft'] = preg_replace( '/\(.+\)/U', '(' . $draft . ')', $views['draft'] );
		}
		return $views;
	}
public function post_type_permission_filter_change_count ( $ views ) { global $ wpdb ; $ current_user = wp_get_current_user ( ) ; $ post_type = $ this -> post_type_slug ; $ all = $ wpdb -> get_var ( " SELECT COUNT(*) 
		     FROM  $ wpdb -> posts  
		     WHERE ( post_status = 'publish' OR post_status = 'draft' ) 
		     AND ( post_author = ' $ current_user -> ID ' AND post_type = ' $ post_type ' ) " ) ; if ( isset ( $ views [ 'mine' ] ) ) { $ mine = $ wpdb -> get_var ( " SELECT COUNT(*) FROM  $ wpdb -> posts  
                 WHERE post_status = 'publish' 
                 AND post_author = ' $ current_user -> ID ' 
                 AND post_type = ' $ post_type ' " ) ; } $ publish = $ wpdb -> get_var ( " SELECT COUNT(*) 
             FROM  $ wpdb -> posts  
             WHERE post_status = 'publish' 
             AND post_author = ' $ current_user -> ID ' 
             AND post_type = ' $ post_type '  " ) ; if ( isset ( $ views [ 'draft' ] ) ) { $ draft = $ wpdb -> get_var ( " SELECT COUNT(*) 
                 FROM  $ wpdb -> posts  
                 WHERE post_status = 'draft' 
                 AND post_author = ' $ current_user -> ID ' 
                 AND post_type = ' $ post_type ' " ) ; } if ( isset ( $ views [ 'all' ] ) ) { $ views [ 'all' ] = preg_replace ( '/\(.+\)/U' , '(' . $ all . ')' , $ views [ 'all' ] ) ; } if ( isset ( $ views [ 'mine' ] ) ) { $ views [ 'mine' ] = preg_replace ( '/\(.+\)/U' , '(' . $ mine . ')' , $ views [ 'mine' ] ) ; } if ( isset ( $ views [ 'publish' ] ) ) { $ views [ 'publish' ] = preg_replace ( '/\(.+\)/U' , '(' . $ publish . ')' , $ views [ 'publish' ] ) ; } if ( isset ( $ views [ 'draft' ] ) ) { $ views [ 'draft' ] = preg_replace ( '/\(.+\)/U' , '(' . $ draft . ')' , $ views [ 'draft' ] ) ; } return $ views ; }
Post Type Permission Filter Change Count.
Post Type Permission Filter Change Count .
// Global // Get Current User // Get Post Type /*
		 * Change the counts
		 *
		 * [all] => <a href="edit.php?post_type=course_unit&#038;all_posts=1" class="current">All <span class="count">(6)</span></a>
		 * [mine] => <a href="edit.php?post_type=course_unit&#038;author=2">Mine <span class="count">(1)</span></a>
		 * [publish] => <a href="edit.php?post_status=publish&#038;post_type=course_unit">Published <span class="count">(5)</span></a>
		 * [draft] => <a href="edit.php?post_status=draft&#038;post_type=course_unit">Draft <span class="count">(1)</span></a>
		 */ // All // Mine // Publish // Draft