function hosting_package_views_access in Hosting 6.2
Same name and namespace in other branches
- 7.4 package/includes/views/hosting_package.views.inc \hosting_package_views_access()
- 7.3 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.
1 call to hosting_package_views_access()
- views_plugin_access_hosting_package::access in package/
views/ views_plugin_access_hosting_package.inc - Determine if the current user has access or not.
1 string reference to 'hosting_package_views_access'
- views_plugin_access_hosting_package::get_access_callback in package/
views/ views_plugin_access_hosting_package.inc - Determine the access callback and arguments.
File
- package/
views/ hosting_package.views.inc, line 278 - 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;
}