You are here

function _og_context_views_page_access in Organic groups 7.2

Helper function to handle views page access.

Parameters

$group_type: The group type.

$perm: The group permission to search for.

$group_id_arg: Optional; The position in arg() where the group ID can be found.

Return value

TRUE if user is allowed access to the page.

1 string reference to '_og_context_views_page_access'
og_context_plugin_access_og_perm::get_access_callback in og_context/includes/views/handlers/og_context_plugin_access_og_perm.inc
Determine the access callback and arguments.

File

og_context/og_context.module, line 672
Get a group from a viewed page.

Code

function _og_context_views_page_access($group_type, $perm, $group_id_arg = FALSE) {
  if ($group_id_arg !== '') {
    $gid = arg($group_id_arg);
    if (is_numeric($gid)) {
      return og_user_access($group_type, $gid, $perm);
    }
  }
  elseif ($group = og_context($group_type)) {

    // Try to get context.
    return og_user_access($group_type, $group['gid'], $perm);
  }
}