You are here

function flag_lists_flag_access in Flag Lists 6

Same name and namespace in other branches
  1. 7.3 flag_lists.module \flag_lists_flag_access()
  2. 7 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 439
The Flag Lists module.

Code

function flag_lists_flag_access($flag, $content_id, $action, $account) {
  if ($flag->module == 'flag_lists') {
    switch ($action) {
      case 'flag':
      case 'unflag':
        if (db_result(db_query("SELECT * from {flag_lists_flags} f WHERE f.uid = %d", $account->uid))) {
          return array(
            'flag_lists' => TRUE,
          );
        }
        else {
          return array(
            'flag_lists' => FALSE,
          );
        }
    }
  }
}