Check if the user has flagged content with any flag
The flag module has a utility function flag_get_flags() that retrieves multiple flags, with an option to filter on the entity type of the flag:
// Same logic, looped over multiple node flags:
$flags = flag_get_flags('node')
foreach ($flags as $flag_name =&gt; $flag) {
  if ($flag &amp;&amp; $flag-&gt;is_flagged($node-&gt;nid, $GLOBALS['user']-&gt;uid)) {
    print &quot;This node is flagged&quot;;
  }
}