How can you allow certain user roles in Wordpress to see a Wordpress plugin I'm writing? Example could be I would like the Administrator and Editor roles to determine my wordpress plugin, although not Customers or Contributing factors?
"See" the wordpress plugin in "Dashboard/Plug ins," or activate and employ the wordpress plugin? They're different ideas. You should use various plug ins to limit roles and wordpress plugin activation: WordPress › WordPress Plugins plus they may limit the visibilty of triggered plug ins.
I'm not sure whether there's a function for that roles particularly, however i know you have access to that information while using usermeta API.
So, for instance, you should use
$capabilities = get_usermeta( $user_id, "wp_capabilities" );
to obtain the role from the user with id, $user_id. For any customer, it might return...
Array ( [subscriber] => 1 )
There might be a far more elegant method of carrying this out, and you will find role management plug ins that may increase the sophistication.
Apparently get_usermeta is going to be deprecated in Wordpress 3. in support of get_user_meta(). Read about this within the Wordpress codex.
I am presuming you need to control the visibility from the wordpress plugin within the front-end UI, by which situation you can get the role while using above and then suggest the UI elements depending on the end result.
Take a look at Adminimize. In my opinion this can accomplish the thing you need and much more.
add your wordpress plugin having a capacity argument.
in case your wordpress plugin access point is definitely an admin page menu, you should use something similar to this:
add_menu_page(page_title, menu_title, capability, handle, [function], [icon_url]);
you are able to set the "capacity" to "upload_files". that function understands that capacity argument as "The minimum capacity needed to show and employ this menu page"
for more information: