From: https://spservices.codeplex.com/discussions/449006
I think that I've discovered a bug in SPGetCurrentUser when in a site which is at the root of the web server e.g. http://mydomain/SitePages/Home.aspx. The relevant code is:
```
var thisWeb = opt.webURL.length > 0 ? opt.webURL : $().SPServices.SPGetCurrentSite();
// Get the UserDisp.aspx page using AJAX
$.ajax({
// Need this to be synchronous so we're assured of a valid value
async: false,
// Force parameter forces redirection to a page that displays the information as stored in the UserInfo table rather than My Site.
// Adding the extra Query String parameter with the current date/time forces the server to view this as a new request.
url: thisWeb + "/_layouts/userdisp.aspx?Force=True&" + new Date().getTime(),
complete: function (xData) {
thisUserDisp = xData;
}
});
```
When at the root, thisWeb = "/", so the url for the ajax call becomes
//_layouts/userdisp.aspx?Force=True&
Notice the double slash at the start, which is obviously nonsense.
To resolve this I added the following after the line to get thisWeb
if (thisWeb == "/")
{
thisWeb = "";
}
and it then worked fine.
Apart from that, great project.
Richard
Comments: Great catch! I have been banging my head over this one. That did the trick...
I think that I've discovered a bug in SPGetCurrentUser when in a site which is at the root of the web server e.g. http://mydomain/SitePages/Home.aspx. The relevant code is:
```
var thisWeb = opt.webURL.length > 0 ? opt.webURL : $().SPServices.SPGetCurrentSite();
// Get the UserDisp.aspx page using AJAX
$.ajax({
// Need this to be synchronous so we're assured of a valid value
async: false,
// Force parameter forces redirection to a page that displays the information as stored in the UserInfo table rather than My Site.
// Adding the extra Query String parameter with the current date/time forces the server to view this as a new request.
url: thisWeb + "/_layouts/userdisp.aspx?Force=True&" + new Date().getTime(),
complete: function (xData) {
thisUserDisp = xData;
}
});
```
When at the root, thisWeb = "/", so the url for the ajax call becomes
//_layouts/userdisp.aspx?Force=True&
Notice the double slash at the start, which is obviously nonsense.
To resolve this I added the following after the line to get thisWeb
if (thisWeb == "/")
{
thisWeb = "";
}
and it then worked fine.
Apart from that, great project.
Richard
Comments: Great catch! I have been banging my head over this one. That did the trick...