Drupal Custom Flag Operations

Create a flag link for a user:

<?php
print flag_create_link('user_flagname', $user_uid);
?>

Get Flag of a Type and see if it is flagged for a node and not the number of times it got flagged.

<?php
$flag
= flag_get_flag('bookmarks') or die('no "bookmarks" flag defined');
if (
$flag->is_flagged($node->nid)) {
  print
"This node is bookmarked!";
}
print
"The number of people who voted for this proposal:";
print
$flag->get_count($node->nid);  //
?>

Flagging or Unflagging an item:
You use the $flag->flag() method to either flag or unflag an item. Example:

<?php
$flag
= flag_get_flag('bookmarks') or die('no "bookmarks" flag defined');

// Flag node #456:
$flag->flag('flag', 456);

// Unflag node #456:
$flag->flag('unflag', 456);
?>

--
Source:
https://drupal.org/node/1748148 : Awesome info

Technologies: