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(&$variables) {
$flag = flag_get_flag('sold'); // Machine name of your flag.
if ($flag && $flag->is_flagged($variables['node']->nid)) {
$variables['classes_array'][] = 'node-flag-sold';
}
$flag = flag_get_flag('withdraw'); // Machine name of your flag.
if ($flag && $flag->is_flagged($variables['node']->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?