Display the flag link only for the node author I'm trying to display the flag link only for the node author, and I'm using the following code:

global $user;
if ($node-&gt;uid == $user-&gt;uid) {
  //print your flag
}


The link doesn't appear.

Do you have any idea on what is causing this?
You may use hook_flag_access(), as in the following code.

 function crystal_qa_flag_access($flag, $entity_id, $action, $account) {
   // Only the author of the question has right to use flag "Accepeted" on answers.
   if (($flag-&gt;name == 'accepted') &amp;&amp; ($flag-&gt;content_type == 'node')  &amp;&amp; ($node = node_load($entity_id))) {
     if ($node-&gt;type=='answer') {
       // The content type machine name must be answer.
       $question_nid = $node-&gt;field_answer['und']['0']['target_id'];
       $question = node_load($question_nid);
       return ($question-&gt;uid == $account-&gt;uid);
     }
   }
 }