Fix regression in main page user stats widget for logged in users

Gravatar could be missing or subtitle be wrong. Caught by browser tests.
Likely caused by incorrect rebasing of an old patch. Some refactoring to
simplify the html as well.

Change-Id: I1f9f02cab331f984d46ddd0cc995bb042f34ad77