SPServices.SPGetCurrentUser Not pulling user

Jan 12 at 7:21 PM
I'm trying to use SPServices to pull the usergroup of the logged in user but it doesn't appear to be grabbing the user. Here's the code I'm using.
<script languague="javascript" type="text/javascript" src="/Style%20Library/JS/jquery-1.9.1.min.js"></script>
<script languague="javascript" type="text/javascript" language="javascript" src="/Style%20Library/JS/jquery.SPServices-2014.02.min.js"></script>
<script languague="javascript" type="text/javascript">
$(document).ready(function() {
 $().SPServices({
  operation: "GetGroupCollectionFromUser",
  userLoginName: $().SPServices.SPGetCurrentUser(),
  async: false,
  completefunc: function(xData, Status) {
  var xml = xData.responseXML.xml;
 
   //If the current User does belong to the group "Business Card Logo Group"
    if (xml.search('Business Card Logo Group') == -1)
     {
          alert("No, User Doesn't Exists!");                   
           $("select[title=Status]").parent().parent().parent().hide();  
          //$('td.ms-formlabel:contains("Logo Selection")').parent().hide();
          $('nobr:contains("Logo Selection")').closest('tr').hide();
       }   
    }
 });
});
</script>
Coordinator
Jan 13 at 5:44 PM
Edited Jan 13 at 5:47 PM
Are you getting any errors? Have you stepped through the code to see if xml is defined?

If you're on Office365 or using claims, $().SPServices.SPGetCurrentUser() will return "i:0#.f|membership|marc.anderson@sympraxisconsulting.com". The SOAP services don't understand claims.

M.
Jan 13 at 9:29 PM
No error messages. Just nothing happens. if I put in an alert
alert($().SPServices.SPGetCurrentUser());
I get nothing. But if I put in
alert($().SPServices.SPGetCurrentSite());
It does successfully return the site name. This is on prem 2013.
Coordinator
Jan 13 at 11:33 PM
$().SPServices.SPGetCurrentUser() should return the user's account by default - the Account field from /_layouts/userdisp.aspx?force=true. That page shows the values in the User Information list in the Site Collection.

Again, if you are using claims, that value will not work for GetGroupCollectionFromUser.

M.