Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: Function $().SPServices.SPGetCurrentUser not working

If all you want is to get the ID, then you don't have to go through SPServices... That information is already available on the page - SP gives it to you... the global variable name is:
_spUserId
or
_spPageContextInfo.userId
This should take care of actually getting the ID... As mark indicated, this sounds like you don't have the references to jQuery correct... Remember that if you placed the code above in the master page, it may not work on all pages because your references to jQuery and SPServices are relative (to the MASTER page)... since the master page gets applied to different pages through out a site, those links will be invalid...

You should use absolute links or links that flow off the Site's root... I can't remember now, but I think there are a few variables you can use on master pages to do this... things like ~Site or $SPUrl... I did a quick search and found this: http://techizs.blogspot.com/2012/02/site-collection-url.html

To test that the references are correct, place the following in your alert:
alert("Executing... jQuery: " + $.fn.jquery + " , SPServices: " + $.fn.SPServices.Version() );

Paul.

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>