When i do my project to develop wordpress become interactive website, like all people can register and upload their artwork and content. I get some problem in user list. The first, i create post type “artwork”, but when i enter to user page, this page cannot showing the post count by artist post type. It’s just show, count from post (default wordpress post type). To slove this problem, i search in my fovorite search engine, yup that is google and i get some solution like bellow,
Showing Users Post Counts
Baca Juga :
<br /> function custom_column_user_count_list($output = '', $column_name, $user_id) {<br /> global $wpdb;</p> <p>if( $column_name !== 'your_post_type_name' )<br /> return;</p> <p>$where = get_posts_by_author_sql( 'your_post_type_name', true, $user_id );<br /> $result = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );</p> <p>return '<a href="' . admin_url("edit.php?post_type=your_post_type_name&author=$user_id") . '" title="Post Type Count">' . $result . '</a>';<br /> }<br /> add_filter('manage_users_custom_column', 'custom_column_user_count_list', 10, 3);</p> <p>function users_columns($columns) {<br /> $columns['your_post_type_name'] = __( 'Your Post Type Name Bar', 'textdomain' );</p> <p>return $columns;<br /> }<br /> add_filter('manage_users_columns', 'users_columns');<br />
That code mybe help you to showing users post counts by custom post type in the admin’s user list.
Thanks to sorich87 for this tutorial