Enhancement Suggestion to $().SPServices.SPGetCurrentUser()

Aug 8, 2010 at 3:29 PM

Suggestion for $().SPServices.SPGetCurrentUser(): Would like it for it to also be able to return the GUID of the user. (request originally sent via twitter)

In looking at the page DOM, I see that there is a variable (_spUserId) that already contains this information... Don't know (at this time) which of the SP scripts sets this value nor do I know how reliable it is. For now, this is my work-around... :)



Aug 9, 2010 at 3:55 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Sep 10, 2010 at 3:15 AM

By GUID, it looks like you mean the user's ID, right? (The GUID is a different value.) _spUserId should reliably provide the ID to you, so I'm not sure if it's worth adding into SPServices. Let me know what you think.


Sep 11, 2010 at 2:19 PM


That is correct, the ID is the value I was looking for... I agree with you, that if the _spUserID is reliable place to get it from, then that should suffice and there is no point in duplicating functionality in your library... My only question would be: is this variable set even with customized "minimal" master pages?  I'm not sure if the .js file that populates it is always loaded with every request to the SP server.

Thanks for your attention to this item.

Sep 11, 2010 at 3:15 PM

I *think* that the _spUserID should always be present, as it probably comes from core.js. In any case, it's impossible for me to manage all of the possibilities if there's heavy customization. At that point, you've got to assume that the folks doing the work must know what they are doing enough to solve their own problems.

I think I may still add this to SPGetCurrentUser just for consistency. Watch the associated issue in the Issue Tracker for updates...


Sep 11, 2010 at 4:00 PM

Thanks Marc.