You are here

function imagepicker_user_has_role in Image Picker 5.2

Same name and namespace in other branches
  1. 6.2 imagepicker.functions.inc \imagepicker_user_has_role()
  2. 7 imagepicker.functions.inc \imagepicker_user_has_role()

Helper function to check if a user has a specific role

File

./imagepicker.module, line 1903
Enables permitted roles to upload images for insertion into configured nodes.

Code

function imagepicker_user_has_role($role, $user = NULL) {
  if ($user == NULL) {
    global $user;
  }
  if (is_array($user->roles) && in_array($role, array_values($user->roles))) {
    return TRUE;
  }
  return FALSE;
}