You are here

function menu_position_menu_position_condition_user_role in Menu Position 7

Same name and namespace in other branches
  1. 7.2 plugins/menu_position.user_roles.inc \menu_position_menu_position_condition_user_role()

Checks if the currently logged in user has a certain role.

Parameters

$variables: An array containing each of the variables saved in the database necessary to evaluate this condition of the rule.

Return value

TRUE if condition applies successfully. Otherwise FALSE.

File

plugins/menu_position.user_roles.inc, line 16
Provides the "User roles" rule plugin for the Menu Position module.

Code

function menu_position_menu_position_condition_user_role($variables) {

  // Check for the roles the currently logged in user has.
  foreach (array_keys($GLOBALS['user']->roles) as $role_id) {
    if (array_key_exists($role_id, $variables['user_role'])) {
      return TRUE;
    }
  }
  return FALSE;
}