$().SPServices.SPGetCurrentUser works for some fields but not others

Oct 31, 2013 at 8:14 PM
First of all, thank you for providing this valuable library. I've read several threads about SPGetCurrentUser and I thought I had it worked out. But here is my specific situation. If created a simple snippet just to test the code provided in your exmaples:
<!-- Reference jQuery on the Google CDN -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script>
<!-- Reference SPServices on cdnjs (Cloudflare) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2013.01/jquery.SPServices-2013.01.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
   var thisUserAccount = $().SPServices.SPGetCurrentUser({fieldName: "Name", debug: false   });
   alert( "thisUserAccount: " +thisUserAccount);

   var thisUserName = $().SPServices.SPGetCurrentUser({ fieldName: "Title",debug: false   });
   alert( "thisUserName: " +thisUserName);

   var thisUserID = $().SPServices.SPGetCurrentUser({fieldName: "ID",debug: false   });
   alert( "thisUserID: " +thisUserID);
Both alerts for thisUserAccount and thisUserName return blanks, but thisUserID returns a value. This leads me to believe that the calls are functioning, but I'm scratching my head as to why some calls return values and some do not.
Oct 31, 2013 at 8:17 PM
Edited Oct 31, 2013 at 8:20 PM
Are you by any chance making the calls from the root site in the Web App? i.e.,
Nov 1, 2013 at 10:07 AM

By chance I am :) (http:/servername/lists/mylist/allitems.aspx). I copied the code to a sub-site and the calls work. Is there a limitation or alternate technique for it to work at the root?
Nov 1, 2013 at 11:53 AM
There's a bug. I have it fixed in the latest alpha.

The fix for you now if to add the webURL option with a value of "/". When I do the next release, that will continue to work, but will no longer be necessary.

Nov 1, 2013 at 9:53 PM

BTW, for one site the "/" wasn't sufficient, so I tried 'http://servername" which worked fine. I'm using document.host for the time being.

Nov 1, 2013 at 10:44 PM
It should work in subsites fine. The bug should only occur in the root site of the Web App.