You are here

function flag_flag::_unflag in Flag 7.2

Same name and namespace in other branches
  1. 5 flag.inc \flag_flag::_unflag()
  2. 6.2 flag.inc \flag_flag::_unflag()
  3. 6 flag.inc \flag_flag::_unflag()

A low-level method to unflag content.

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

@private

Return value

If the content was flagged, returns the value of the now deleted 'fcid' column. Else, returns FALSE.

1 call to flag_flag::_unflag()
flag_flag::flag in ./flag.inc
Flags, or unflags, an item.

File

./flag.inc, line 828
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function _unflag($content_id, $uid, $sid) {
  $fcid = db_select('flag_content', 'fc')
    ->fields('fc', array(
    'fcid',
  ))
    ->condition('fid', $this->fid)
    ->condition('uid', $uid)
    ->condition('sid', $sid)
    ->condition('content_id', $content_id)
    ->execute()
    ->fetchField();
  if ($fcid) {
    db_delete('flag_content')
      ->condition('fcid', $fcid)
      ->execute();
    $this
      ->_decrease_count($content_id);
  }
  return $fcid;
}