Get a user’s role by user ID
-
I’ve searched high and low for some sort of function to grab a user’s role, but have yet to find a solution. I can check in the
wp_capabilities
table to see if a user has a particular role, but this won’t work in this particular situation.The problem:
I need to grab a user’s role to use in other functions. The project I’m working on will have roles that might change, so there’s no definite set of roles (i.e., administrator, editor, etc.) like with a standard WP setup. For example, a particular role might be
super_geek
oruber_geek
. There’s just no way for me to know what the roles will be beforehand.Just to clarify: I don’t need the user’s capabilities because capabilities will cross over between roles.
Does anyone know a way of grabbing a user’s role from the database based on the user’s ID?
- The topic ‘Get a user’s role by user ID’ is closed to new replies.