function views_php_check_access in Views PHP 7.2
Same name and namespace in other branches
- 8 views_php.module \views_php_check_access()
- 6 views_php.module \views_php_check_access()
- 7 views_php.module \views_php_check_access()
Menu access callback function; use PHP code to determine whether a user as access.
1 call to views_php_check_access()
- views_php_plugin_access::access in plugins/
views/ views_php_plugin_access.inc - Implements views_plugin_access#access().
1 string reference to 'views_php_check_access'
- views_php_plugin_access::get_access_callback in plugins/
views/ views_php_plugin_access.inc - Implements views_plugin_access#get_access_callback().
File
- ./
views_php.module, line 21 - Allows to use PHP in views.
Code
function views_php_check_access($php_access, $view_name, $display_id, $account = NULL) {
global $user;
static $function = array();
if (!isset($account)) {
$account = $user;
}
if (!isset($function[$view_name . ':' . $display_id])) {
$function[$view_name . ':' . $display_id] = function ($view_name, $display_id, $account) use ($php_access) {
return eval($php_access . ';');
};
}
ob_start();
$access = (bool) $function[$view_name . ':' . $display_id]($view_name, $display_id, $account);
ob_end_clean();
return $access;
}