I am using custom user roles which I create and assign by using a plugin. I was wondering how I could retrieve the user's role and store it in a PHP variable.
What I am trying to achieve is something like this:
Let's say I created 3 custom user roles: role_apple, role_banana and role_carrot
if ( 'role_apple' === $user_role ) {
echo 'User is an apple';
}
elseif ( 'role_banana' === $user_role ) {
echo 'User is a bannana';
}
How this can be achieved?