Created
September 14, 2013 05:30
-
-
Save danemorgan/6559061 to your computer and use it in GitHub Desktop.
Get the number of users currently assigned to specified role.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function count_users_by_role( $user_role ) { | |
| // Standard User Roles: all, administrator, editor, author, contributor, subscriber | |
| $result = count_users(); | |
| $totalUsers = $result['total_users']; | |
| if( 'all' == $user_roll || '' == $user_roll ) : | |
| return $totalUsers; | |
| else : | |
| return $result['avail_roles'][$type]; | |
| endif; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment