Conditionally display a field based on another field's content by field.tpl.php What i would like to achieve is to be able to show the field's content only if another field of the node being displayed has a certain value. So I'd like to put an if condition at the beginning of the custom field.tpl.php that controls whether the content is public or restricted based on another field's value (whether the node is tagged as free or not).    

Actually, what I am trying to achieve is  to make a double control: if the node is tagged FREE, display it right away, if not, see the user's permissions and display it of he has "paid user" role (just to explain things).
I don't think that you need a custom field.tpl.php or custom module. You can just copy the field.tpl.php from a field module and modify it. Look at comments above the field.tpl.php:


$items: An array of field values. Use render() to output them.
...
$element['#object']
$element['#field_name']
you can get user info from global $user object;


i think these are key variables which you can use.
E.g. (poorly modified version of field.tpl.php. But logic is like this):

&lt;?php
  global $user;
?&gt;

&lt;div class="&lt;?php print $classes; ?&gt;"&lt;?php print $attributes; ?&gt;&gt;
  &lt;?php if (!$label_hidden): ?&gt;
    &lt;div class="field-label"&lt;?php print $title_attributes; ?&gt;&gt;&lt;?php print $label ?&gt;:&amp;nbsp;&lt;/div&gt;
  &lt;?php endif; ?&gt;
  &lt;div class="field-items"&lt;?php print $content_attributes; ?&gt;&gt;
    &lt;?php foreach ($items as $delta =&gt; $item): ?&gt;

      &lt;?php
        if($element['#field_name'] == 'field_NAME') {
          if($item == 'MY_VALUE (e.g. free)') {
            $output = render($item);
          }
          elseif($item != 'MY_VALUE (e.g. free)' &amp;&amp; isset($user-&gt;roles[MY_ROLE_KEY]) {
            $output = render($item);
          }
          else {
            $output = ''; // or whatever you want
          }
        }
      else {
        $output = render($item);
      }
      ?&gt;

      &lt;div class="field-item &lt;?php print $delta % 2 ? 'odd' : 'even'; ?&gt;"&lt;?php print $item_attributes[$delta]; ?&gt;&gt;&lt;?php print $output; ?&gt;&lt;/div&gt;
    &lt;?php endforeach; ?&gt;
  &lt;/div&gt;
&lt;/div&gt;


//P.S. Putting your logic into .tpl is not good..