I want to hide the Ribbon in Office 365 SharePoint according to the group that this user was able to extract the group to which the user belongs, I can not compare it with a string does not fall within the IF, to hide the ribbon this is my code if I can help please thanks.
var Nombre_Grup="";
$(document).ready(function()
$().SPServices(
{ //inicio de SPservices
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function(xData, Status)
{
$(xData.responseXML).find("Group").each(function()
{
Nombre_Grup = $(this).attr("Name");
});
}
});
console.log(Nombre_Grup);
if(d == "Usuarios de distribución rápida")
{
$('#s4-ribbonrow').hide();
}
else if (Nombre_Grup == "Diseñadores")
{
$('#s4-ribbonrow').show();
}
});
Use
Nombre_Grup = $(this).attr("Name").trim();
to remove any surrounding whitespace in the field.