Apparently the
key was to use "$skin = $wgUser->getSkin();"...
Didn't work using $this as $skin?
To be honest, I'm not sure; I don't really remember what exactly I'd
tried before giving up - but a friend helped me fix it eventually, and
I'll just trust his judgment there...
If you're interested, I'd posted the entire code as a sample here: