Get User Role

A simple plugin that add's the get_user_role() function to your site.

Author:Dave Legassick (profile at wordpress.org)
WordPress version required:3.0.1
WordPress version tested:3.4.2
Plugin version:1.0
Added to WordPress repository:25-11-2012
Last updated:25-11-2012
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://wordpress.org/extend/plugins/get-user-...
Total downloads:1 376
Active installs:10+
plugin download
Click to start download

This plugin doesn't do anything on the surface but if you call the get_user_role() function then you can achieve one of two results.

Function

Returns the role of the specified user.

Usage

Parameters

$user_id (string)(optional) 'username'

Return Values

(string) If no $user_id is specified in the function call the function will return the role of the currently logged in user, otherwise the role of the specified user will be returned.

Examples

$role = get_user_role("admin");

This will return "administrator".

Notes

This plugin may call the following global variables:

$current_user $wp_roles $wpdb

This plugin is designed to work with any correctly made custom roles.


FAQ
ChangeLog