How to print a string for flagged nodes? I have a flag called "Mark as SOLD" which can be flagged only by node author. When he flags it as "Sold", I want the node teaser to print a translatable string t('SOLD'), so that everyone else (even anonymous) can see that this item is now sold.

In my corolla template.php I already have custom function that gives classes to different flags:

    function corolla_preprocess_node(&amp;$variables) {
  $flag = flag_get_flag('sold'); // Machine name of your flag.
  if ($flag &amp;&amp; $flag-&gt;is_flagged($variables['node']-&gt;nid)) {
    $variables['classes_array'][] = 'node-flag-sold';
  }
$flag = flag_get_flag('withdraw'); // Machine name of your flag.
  if ($flag &amp;&amp; $flag-&gt;is_flagged($variables['node']-&gt;nid)) {
    $variables['classes_array'][] = 'node-flag-withdraw';   
  }
}


But I know that I need to modify this function and/or node--type.tpl.php to actually print a string t('SOLD').   

How can I achieve this?
You can set a new variable in your preprocess function and print it in your node--type.tpl.php as follows:

In template.php

function YOURTHEME_preprocess_node(&amp;$variables) {
  $node = $variables['node'];
  if ($node-&gt;type == 'YOUR_CONTENT_TYPE') {
    $flag = flag_get_flag('sold');
    if ($flag &amp;&amp; $flag-&gt;is_flagged($node-&gt;nid)) {
      $variables['classes_array'][] = 'node-flag-sold';
      $variables['flagged_text'] = t('Sold');
    }
  }
}


And in your node--YOUR-CONTENT-TYPE.tpl.php, put simply this snippet wherever you want to print the string:

&lt;?php if ($flagged_text): ?&gt;
  &lt;?php print $flagged_text; ?&gt;
&lt;?php endif; ?&gt;


or the same code shorter:

&lt;?php if ($flagged_text) print $flagged_text; ?&gt;


But the first one is better for readability and follows the Drupal's coding standards for template files.