[wp-hackers] Get list of roles

Peter Westwood peter.westwood at ftwr.co.uk
Sat Sep 11 08:31:04 UTC 2010


On 11 Sep 2010, at 08:48, Ryan Bilesky wrote:

> I can't seem to figure out how to get this to work.
> 
> I am trying to get a list of roles, (not just assume there is only the
> default roles) to build an options page for a plugin I'm working on.  I
> would have table to control what roles get certain custom capabilities.  I
> cannot seem to figure out how to get all the role names, so I can build my
> form to change my plugin specific capabilities.

	global $wp_roles;
	var_dump ($wp_roles->get_names());

As long as the global has been setup by the time you call the function.

westi
-- 
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5



More information about the wp-hackers mailing list