Ok, if no support is given, I will post my clean, optimised code when I get home.
The main issue that made my stomach turn about this hack is that it is loop querying the profilefield table to check if it is set, when everybody knows that all this info is contained in the $bbuserinfo variable

I got it down to adding 1 query (the one to check whether or not a field is required, if Im not too much mistaken)