So here is the small snippet to show total number of users and all roles with user count. This code should go in the themes functions.php
file.
The code uses count_user
function to fetch the array and show it up on Right Now dashboard screen.
function wpse_60487_custom_right_now() {
$users = count_users();
echo '<table><tbody>';
echo '<tr><td class="first b b_pages">'.$users['total_users'].'</td><td class="t pages"> total users</td></tr>';
foreach($users['avail_roles'] as $role => $count)
echo '<tr><td class="first b b_pages">'.$count.'</td><td class="t pages">'.$role.'</td></tr>';
echo '</tbody></table>';
}
add_action( 'wpse_60487_custom_right_now', 'dashboard_wps_user_count');
Related Posts:
- alphabetically order role drop-down selection in dashboard
- BuddyPress | Check if user is in current group [closed]
- Set default page for user account in admin
- How do I customize the dashboard?
- Allow user access to Dashboard only!
- Removing all trace of member profiles
- Remove users access to dashboard
- How do I modify the user role ‘subscriber’ to allow the user to delete posts
- Custom User Role: Can Edit Own Page, Cannot Create New
- Restrict Access to the User Profile
- Set user role on registration so can upload file to own media library area
- Edit dashboard based on user ID
- Restrict access to certain dashboard pages based on user id
- How to create front-end (editable) WordPress user profile pages?
- hide woo commerce dashboard status and reports from woo commerce from specific users but display to other users
- If the current user is an administrator or editor
- How do I add a field on the Users profile? For example, country, age etc
- WordPress usermeta scaling for thousands of users
- Groups of capabilities: users with multiple roles?
- Is there a way to merge two users?
- How to restrict access to uploaded files?
- Execute a function when admin changes the user role
- Best way to send users password?
- Importing users? From another wordpress site
- How to discover and delete unused accounts?
- Multi-steps WordPress registration : in 4 steps how to?
- Allow guests to save favourite pages?
- Basic auth WordPress REST API dilemma
- Show Biographical Info while creating new user
- How to enable the theme editor cap for an editor role?
- WordPress keeps asking for connection information in localhost
- importing users where password is provided as md5 + much metadata
- How can I secure a WordPress blog using OpenID from a single provider?
- How to edit user_id on the comment edit screen
- Redirect after login based on user role (custom login page)
- get_users() ORDER BY Not Working
- Can I create users that have access to *some* other users posts instead of all other users posts?
- My custom page template with is_user_logged_in() does not detect that I’m logged in
- Total Word Count For Posts And Comments By One Author
- Delete user from frontend
- Share user table from WP with Drupal
- How can I display show/hide elements when user is registered?
- How can I allow password reset based on logins containing the @ character?
- Register new user in the frontend
- Force logout ALL users at a certain time
- Show MD5 Password in user section
- User Last Login Sort Column
- get_users() timeout on big userbase — options to divide query?
- Plugin for limiting user registration based on ip with expiry period?
- Using user_status in conditional with get_users to return existing users
- Split Blog Into Two Sections?
- how to update or refresh the wp user object?
- mysql query two database tables, users and usermeta and sort by custom meta int value
- Including users in insert link internal link search in Gutenberg
- Force user to change their password on the frontend at the first login and password policy
- Should I encrypt the response that triggers an Ajax action? Is nonce sufficient?
- How to force authors to ‘submit for review’?
- Turn off password requirement
- How to duplicate a wordpress user and all his/her data from custom fields?
- How do I transfer user passwords from one WordPress site to another?
- How can I authenticate user credentials against a WordPress instance?
- Add a role and give admin priviledges
- Use WordPress Login for a non-wordpress site
- How to change user`s avatar?
- Add Custom Filter to Admin User list
- WordPress SQL Issue not returning correct reselts
- How to get last user with wpdb?
- Restrict access to non-wordpress section of site with user roles?
- how to remove email field from default user registration form on wordpress
- Add custom user meta data
- Does it matter if the very first user, usually Admin, does not have a user ID of 1?
- How to set default’ => $current_user->user_login
- Groups and subgroups for permission
- Can i use two different user tables for on WP install?
- Making WordPress available while logged into another website
- Get user ID when action row link is clicked
- wp_delete_user – huge overhead in Buddypress?
- Get current logged-in user from external site
- Delete all users with Editor role and their content mysql
- Send user auto generated password on different email
- Load Custom Field to User Profile as per User Role using Ajax
- Get UserInfo from WordPress
- How to display a calendar with events depending on the user?
- How to show different pages for different users
- How can i display pagination in custom comment list?
- hide page menu from admin panel for specific users
- Single Sign On (SSO) between two WordPress websites
- Disabling user capability to edit_posts or delete_posts in the front-end
- Redirect /member/ to /member/user
- $user_login is not working if author has only 1 post
- How to bulk change user role to “No role for this site”
- Showing extra profile fields in admin – problem with underscore
- Insert query not working for non-logged in user
- Disallow user registration/checkout via Hotmail/Yahoo
- How to create a link to a user’s profile page
- Storing additional information about the user
- Current User Seeing Another Logged In User Info
- What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
- New User Registration email
- Remove @gmail.com from WordPress username