NotOneBit Blog

Get started today on your next web project with NotOneBit
We've been doing web development before you were born *

Two WordPress Plugins To Improve Your User Management Page (Part 2)

In the second part of this post I’ll show you how you can add a column that lists the total number of pages for a user with a break out of the drafts, pending private, and published. Each element is linked to the respective list of pages. Note that this modification removes the Posts column from the user page, however if you wish to retain it, remove the first five lines (the notonebit_modify_user_columns and the associated add_filter call).


The following code would be added to your theme’s functions.php file.

* Mod to add a pages column with detail to the users page. Also removes the posts column 
add_filter('manage_users_columns', 'notonebit_modify_user_columns');
function notonebit_modify_user_columns( $cols ) {
 return array_merge( $cols, array( 'num_posts' => 'Pages' ) );
function notonebit_count_user_posts_by_type_and_status( $userid, $post_status, $post_type = "post" ) {
 global $wpdb;
 $where = "WHERE post_author = " . $userid . " AND post_type = '" . $post_type . "' AND (post_status = '" . $post_status . "')";
 $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );
 return $count;
add_action('manage_users_custom_column', 'notonebit_user_posts_count_column_content', 10, 3);
function notonebit_user_posts_count_column_content($output, $column_name, $user_id) {
 $user = get_userdata( $user_id );
 if ( 'num_posts' == $column_name ) {
 $drafts = notonebit_count_user_posts_by_type_and_status( $user_id, 'draft', 'page' );
 $published = notonebit_count_user_posts_by_type_and_status( $user_id, 'publish', 'page' );
 $pending = notonebit_count_user_posts_by_type_and_status( $user_id, 'pending', 'page' );
 $private = notonebit_count_user_posts_by_type_and_status( $user_id, 'private', 'page' );
 $all = $drafts + $published + $pending + $private;
 return 'All: <a href="/wp-admin/edit.php?author='.$user_id.'&amp;post_type=page">'.$all.'</a>
 <br />Draft: <a href="/wp-admin/edit.php?post_status=draft&amp;post_type=page&amp;author='.$user_id.'">'.$drafts.'</a>
 Pending: <a href="/wp-admin/edit.php?post_status=pending&amp;post_type=page&amp;author='.$user_id.'">'.$pending.'</a>
 Published: <a href="/wp-admin/edit.php?post_status=publish&amp;post_type=page&amp;author='.$user_id.'">'.$published.'</a>
 Private: <a href="/wp-admin/edit.php?post_status=private&amp;post_type=page&amp;author='.$user_id.'">'.$private.'</a>';

2 thoughts on “Two WordPress Plugins To Improve Your User Management Page (Part 2)

  1. Hello Admin, thank you so much for your great solutions and all of your hard work. But I am in serious need of your help! I am using your awesome jQuery Infinite Carousel that you developed a few years ago and it works beautifully!!! No problems at all. However, I am now trying to load the carousel dynamically within a SharePoint 2010 team site. I have the dynamic content loading to the page with no problems. I also have the carousel (ul id=”carousel”) working properly when I “hard code” the list (LI) items as originally designed. But when I load my dynamic content (ul id=”sampleUL”) into the carousel, I get a blank canvas (the actual height of carousel) but with no content. :( Please help me figure this out! Please. :)

  2. Hi Admin, thank you such a great amount for your extraordinary arrangements and the majority of your diligent work. However, I am in genuine need of your assistance! I am utilizing your great jQuery Infinite Carousel that you built up a couple of years prior and it works wonderfully!!! No issues by any stretch of the imagination. Be that as it may, I am currently endeavoring to stack the merry go round progressively inside a SharePoint group site. I have the dynamic substance sticking to the page without any issues. I likewise have the merry go round working appropriately when I “hard code” the rundown (LI) things as initially structured. However, when I load my dynamic substance into the merry go round, I get a clear canvas (the real stature of merry go round) yet with no substance.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: