I have previously posted a solution for pulling user information from the built-in user information list in SharePoint (found in WSS 3.0, MOSS 2007 and SharePoint 2010 both foundation and server). This is NOT the user profile found in MOSS 2007 and in SharePoint 2010 server. You find the solution here
This solution is an updated version of the script – and should hopefully work better with sites on a managed path.
I have incorporated the new “getUserInfo_v2” in the file “spjs-utility.js”.
The parameter “_spUserId” is provided by SharePoint and represents the current user’s userID.
The function takes one argument which can be a userID or a login name (domainlogin or appname:user). If you use domainuser as a string like this:
var userInfoObj = getUserInfo_v2("contoso\alexander");
The variables “name” and “email” are examples, the full range of “out of the box fields” are:
ID, Name, Title, EMail, Department, JobTitle, Notes, Picture, IsSiteAdmin, Created, Author, Modified, Editor, SipAddress
You can download the file “spjs-utility.js” here. Ensure you pick the version dated 18.09.2011, or newer.