You are here

function flag_lists_get_flag in Flag Lists 6

Same name and namespace in other branches
  1. 7.3 flag_lists.module \flag_lists_get_flag()
  2. 7 flag_lists.module \flag_lists_get_flag()

Get a specific flag.

Using this instead of flag_get_flag() for performance.

7 calls to flag_lists_get_flag()
flag_lists_delete_confirm in ./flag_lists.admin.inc
Delete flag lists page.
flag_lists_delete_confirm_submit in ./flag_lists.admin.inc
flag_lists_form in ./flag_lists.admin.inc
Form to Add or edit a list.
flag_lists_form_submit in ./flag_lists.admin.inc
Save a list.
flag_lists_get_flagged_content in ./flag_lists.module
Get all flagged content in a flag.

... See full list

File

./flag_lists.module, line 723
The Flag Lists module.

Code

function flag_lists_get_flag($fid) {

  // If we don't have an fid, then we have the flag name.
  if (!is_numeric($fid)) {
    $fid = db_result(db_query("SELECT fid from {flag_lists_flags} WHERE name = '%s'", $fid));
  }
  $result = db_query("SELECT fl.*, ft.type FROM {flag_lists_flags} fl LEFT JOIN {flag_types} ft on ft.fid = fl.pfid WHERE fl.fid = %d", $fid);
  while ($row = db_fetch_object($result)) {
    if (!isset($flag->name)) {
      $flag = flag_flag::factory_by_row($row);
    }
    else {
      $flag->types[] = $row->type;
    }
  }
  return $flag;
}