You are here

function opigno_live_meetings_node_access in Opigno Moxtra App 7

File

modules/opigno_live_meetings/opigno_live_meetings.module, line 52

Code

function opigno_live_meetings_node_access($node, $op, $account) {

  // If the meet has a class restriction, check if the user is in the class. If he's not, deny the access
  //   By doing that, the node will be hidden to the list (opigno_live_meetings_views_post_execute() do that)
  if ($node->type == 'live_meeting' && !empty($node->field_class_ref)) {
    $is_member = false;
    foreach ($node->field_class_ref[LANGUAGE_NONE] as $class_target) {
      if (og_is_member('node', $class_target['target_id'])) {
        $is_member = true;
      }
    }
    if ($is_member == false) {
      return NODE_ACCESS_DENY;
    }
  }
  return NODE_ACCESS_IGNORE;
}