XF 1.5 Need idea to migrate a VB3 "poor man's medal system" to XF


Active member
we want to migrate from an old VB3 (active since early 2000) to XF. They have implemented a custom string-field managed by the admin containing years a memer did a donation like this: {2003}{2006}{2008} and so on.
InVB3 there are replacement-templates for each year, that replace eg. {2006} with a link and a gif on the server for the year. See example here:
It needs to show up only in the sidebar in the profile.

After importing the VB3 database I used the ValueHTML with some JS to regex-split the years-string and spit out HTML:
<script type="text/javascript">
var val = "{$value}"

var jahre = val.match(/\d+/g);

for (len = jahre.length, i=0; i<len; ++i) {
document.write('<A HREF="#" ONCLICK=\'window.open("/contribute.htm","falk","width=650,height=400, scrollbars=no"); return false;\'><B><img border="0" src="images/medal' + jahre[i] + '.gif" width="33" height="36"></a>')
This worked well for the general forum but if I try to post I get into trouble because of the document.write() and after submitting a post I only see a new document with just the medals. I quickly checked the result-doc to spot an element-id where I could put an .innerHTML but the only ID I found was for the full custom-fields block.

What options do I have ? Is there a way to perhaps hide the customfield via CSS just while posting ?

I thought of doing a DB-wide update for all years eg {2003} to custom BBcode like [Medal]2003[/Medal], but this seems a lot of effort for this simple usecase.

As I am new to XF's template system: can I do a regex/split/loop in there like in JS ? Or code a template that checks and replaces each year individually (like it is on the current VB? )

Thanks in advance for some inspirantions :)