For anyone who stumbles about it, a year later I realized how.
Register SPSWC on the main page (if you are using Randy Drisgill starter> it will already be there).
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Then, before you want to access the property (for example: UserName), insert the data
<SPSWC:ProfilePropertyLoader runat="server"/>
Then, to access one of the properties, I would recommend using TitleMode to insert it into the <script>
element.
<script> var username = '<SPSWC:ProfilePropertyValue PropertyName="UserName" TitleMode="true" runat="server"/>'; </script>
Now we use it, as shown in this PasteBin demo , to populate the global object with several properties, such as first name, last name, username, profile picture, status.
source share