function flag_lists_is_owner in Flag Lists 6
Same name and namespace in other branches
- 7.3 flag_lists.module \flag_lists_is_owner()
- 7 flag_lists.module \flag_lists_is_owner()
Helper function to test if a flag is owned by the current user, or current user can administer flags.
2 calls to flag_lists_is_owner()
1 string reference to 'flag_lists_is_owner'
- flag_lists_menu in ./
flag_lists.module - Implementation of hook_menu().
File
- ./
flag_lists.module, line 512 - The Flag Lists module.
Code
function flag_lists_is_owner($action, $name) {
global $user;
if (user_access('administer flags')) {
return TRUE;
}
// If we don't have an fid, then we have the flag name.
if (is_numeric($name)) {
$name = db_result(db_query("SELECT name from {flag_lists_flags} WHERE fid = %d", $name));
}
if (!user_access($action . ' own flag lists')) {
return FALSE;
}
if (db_result(db_query("SELECT * from {flag_lists_flags} f WHERE f.name = '%s' AND f.uid = %d", $name, $user->uid))) {
return TRUE;
}
return FALSE;
}