function flag_lists_flag_access in Flag Lists 7
Same name and namespace in other branches
- 6 flag_lists.module \flag_lists_flag_access()
- 7.3 flag_lists.module \flag_lists_flag_access()
Implementation of hook_flag_access().
Make sure a user can only see his/her own personal flags.
File
- ./
flag_lists.module, line 814 - The Flag Lists module.
Code
function flag_lists_flag_access($flag, $content_id, $action, $account) {
if (!empty($flag->module) && $flag->module == 'flag_lists') {
switch ($action) {
case 'flag':
case 'unflag':
$fid = db_select('flag_lists_flags', 'f')
->fields('f')
->condition('f.uid', $account->uid)
->execute()
->fetchField();
if (!empty($fid)) {
return array(
'flag_lists' => TRUE,
);
}
else {
return array(
'flag_lists' => FALSE,
);
}
}
}
}