You are here

function _flag_lists_unflag in Flag Lists 7

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

A low-level method to unflag content.

You probably shouldn't call this raw private method: call the flag_lists_do_flag() function instead.

1 call to _flag_lists_unflag()
flag_lists_do_flag in ./flag_lists.module
Flags, or unflags, an item.

File

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

Code

function _flag_lists_unflag($flag, $content_id, $uid, $sid) {
  $query = db_select('flag_lists_content')
    ->condition('fid', $flag->fid)
    ->condition('content_id', $content_id)
    ->condition('uid', $uid)
    ->condition('sid', $sid);
  $query
    ->addField('flag_lists_content', 'fcid');
  $fcid = $query
    ->execute()
    ->fetchField();
  if ($fcid) {
    db_delete('flag_lists_content')
      ->condition('fcid', $fcid)
      ->execute();
    _flag_lists_update_count($flag, $content_id);
  }
  return $fcid;
}