You are here

function rooms_unit_access_filter in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Filters rooms unit based on permissions for multiple values.

File

modules/rooms_unit/rooms_unit.module, line 221
Manage units - Units are things that can be booked on a nightly basis (e.g. rooms - but also villas bungalows, etc).

Code

function rooms_unit_access_filter($op, $units = array(), $account = NULL) {
  $filtered_units = array();

  // If no user object is supplied, the access check is for the current user.
  if (empty($account)) {
    $account = $GLOBALS['user'];
  }
  foreach ($units as $key => $unit) {
    if (rooms_unit_access($op, $unit, $account)) {
      $filtered_units[$key] = $unit;
    }
  }
  return $filtered_units;
}