I would do a slightly different approach that doesn't involve a template edit:
First of all, we don't want to know every group the user is in, we just want to know if they are in (your case) group 10.
Second, running this query for every user can be time consuming. This adds a query per post, you can find out every user in a topic that is in group X by using this query:
select distinct(t1.USER_ID)
from ubbt_USER_GROUPS as t1,
ubbt_POSTS as t2
where
t1.USER_ID = t2.USER_ID
and t1.GROUP_ID = 7
and t2.TOPIC_ID = 18499
Using this query, you could build an array with every user from topic 18499 that is in group 7.
In /scripts/showflat.inc.php you could check out that array to adjust the Membertitle string to add a graphic.
find:
if ($CustomTitle && $config['ONLY_CUSTOM']) {
$postrow[$i]['Title'] = $CustomTitle;
$CustomTitle = "";
} else {
$postrow[$i]['Title'] = $Title;
$postrow[$i]['CustomTitle'] = $CustomTitle;
}
There the title is put in a string.
If you put some code just below there to add a string to the customtitle string with a graphic, you don't need to adjust the templates, and it will work for both post_side and post_top templates.
I can be more complete about this next year if you need more help, I know it sounds ages, but it's actually tomorrow
