2014.02 and SPGetCurrentSite/SPGetCurrentUser

May 13, 2015 at 10:56 PM
Edited May 14, 2015 at 3:20 AM
While Marc did a great job fixing the issue with the CurrentSite/User that plagued the previous versions, I found a conflict with use of the DFFS by Alexander (SPJSblog.com). One of the DFFS requirements for SP2007 is to add
var _spPageContextInfo = {"pageListId":"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"};
due to the fact Alexander no longer had access to a SP2007 site for dev testing. After reviewing all the functions in SPServices, I noticed SPServicesContext is set based on a rule of
  if (typeof _spPageContextInfo !== "undefined") {
            this.thisSite = siteRoot + _spPageContextInfo.webServerRelativeUrl;
            this.thisList = _spPageContextInfo.pageListId;
            this.thisUserId = _spPageContextInfo.userId;
            // In SharePoint 2007, we know the UserID only
        } else {
            this.thisSite = (typeof L_Menu_BaseUrl !== "undefined") ? siteRoot + L_Menu_BaseUrl : "";
            this.thisList = "";
            this.thisUserId = (typeof _spUserId !== "undefined") ? _spUserId : undefined;
The fix is to add the other 2 properties to the top of the page as such:
var _spPageContextInfo = {"pageListId":"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}","webServerRelativeUrl":"/Departments/HR","userId":"_spUserId"}; 
(replace the '/Departments/HR' with the relative path for your site)

I hope this helps any users who have loaded both jquery libs.

Thanks again to Marc for all his work on this critical support library.