This project has moved and is read-only. For the latest updates, please go here.

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

Oct 31, 2013 at 9: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="" type="text/javascript"></script>
<!-- Reference SPServices on cdnjs (Cloudflare) -->
<script src="" 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 9:17 PM
Edited Oct 31, 2013 at 9:20 PM
Are you by any chance making the calls from the root site in the Web App? i.e.,
Nov 1, 2013 at 11: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 12:53 PM
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 10:53 PM

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

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