function hosting_package_views_access in Hosting 7.3
Same name and namespace in other branches
- 6.2 package/views/hosting_package.views.inc \hosting_package_views_access()
- 7.4 package/includes/views/hosting_package.views.inc \hosting_package_views_access()
Views access callback.
Parameters
$type: The display plugin.
$display: The display ID (machine_name).
$account: The current user.
Return value
bool
1 call to hosting_package_views_access()
- hosting_package_plugin_access::access in package/
includes/ views/ plugins/ hosting_package_plugin_access.inc - Determine if the current user has access or not.
1 string reference to 'hosting_package_views_access'
- hosting_package_plugin_access::get_access_callback in package/
includes/ views/ plugins/ hosting_package_plugin_access.inc - Determine the access callback and arguments.
File
- package/
includes/ views/ hosting_package.views.inc, line 252 - Hosting package views integration.
Code
function hosting_package_views_access($type, $display, $account = NULL) {
switch ($type) {
case 'page':
$path = explode('/', drupal_get_normal_path($_GET['q']));
$nid = $path['1'];
if (is_numeric($nid)) {
$node = node_load($nid);
if (!is_null($account) && (!user_access('view package', $account) || !node_access('view', $node, $account))) {
return FALSE;
}
switch ($display) {
case 'page_packages_site':
return $node->type == 'site' && $node->site_status != -2;
break;
case 'page_packages_platform':
return $node->type == 'platform' && $node->platform_status != -2;
break;
}
}
break;
case 'block':
if ($node = menu_get_object()) {
return $node->type == 'package' && $node->package_type != 'profile';
}
break;
default:
return FALSE;
}
return FALSE;
}