function _heartbeat_access_type_has_access in Heartbeat 6.4
Helper function to check access on an Access type activity stream
1 call to _heartbeat_access_type_has_access()
- heartbeat_stream_view in ./
heartbeat.module - Helper function to load a heartbeat stream / access type
1 string reference to '_heartbeat_access_type_has_access'
- heartbeat_menu in ./
heartbeat.module - Implementation of hook_menu().
File
- ./
heartbeat.module, line 1688
Code
function _heartbeat_access_type_has_access($access_type, $account = NULL) {
$access = FALSE;
$stream_type = heartbeat_stream_load($access_type);
if (user_access('view heartbeat messages')) {
// Allow for all
if (!isset($stream_type['access'])) {
$access = TRUE;
}
elseif (is_bool($stream_type['access']) || is_numeric($stream_type['access'])) {
$access = $stream_type['access'];
}
elseif (is_string($stream_type['access']) && function_exists($stream_type['access'])) {
$access = call_user_func($stream_type['access']);
}
elseif (is_array($stream_type['access'])) {
if (!isset($account)) {
global $user;
$account = $user;
}
$access = user_access($stream_type['access'][0], $account);
}
}
return $access ? $stream_type : $access;
}