function flag_filter_handler_uid in Flag 5
Handler that lets us filter nodes to include only those by a particular user.
1 string reference to 'flag_filter_handler_uid'
- flag_views_tables in includes/
flag.views.inc - Implementation of hook_views_tables
File
- includes/
flag.views.inc, line 240 - Provides support for the Views module.
Code
function flag_filter_handler_uid($op, $filter, $filterinfo, &$query) {
// Load the views flag to check if it's global.
$flag = flag_get_flag(NULL, $filterinfo['fid']);
$tn = $query
->add_table($filterinfo['table']);
$tname = $query
->get_table_name($filterinfo['table'], $tn);
$query
->add_where("{$tname}.uid {$filter['operator']} NULL");
if ($filter['value'] == '***CURRENT_USER***' && !$flag->global) {
$query
->add_where("{$tname}.uid = ***CURRENT_USER***");
}
}