Hi All,
I have requirement to show current user group name (site level) when logged into SharePoint 2010 portal.
I used below spservice code to get current user group name,
$(document).ready(function () {
var loggedinUserGroup =””;
$().SPServices({
operation: “GetGroupCollectionFromUser”,
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function (xData, Status) {
$(xData.responseXML).find(“Group”).each(function()
{
 loggedinUserGroup = $(this).attr(“Name”);
});
}
}
});
});
Current user has many groups in site collection level. (Ex: GrpA, GrpB, GtrpC and grpD)
In sub site the user was associated with only one group (Ex: GrpC)
My question is, when the user login into the site, it should pick only GrpCÂ from sub site instead it takes the all groups from site-collection level.Â
Even i used webURL param (webURL: _spPageContextInfo.webServerRelativeUrl)Â in the above method but the result remains the same
Rajesh, you’re also sort of misunderstanding how SharePoint permissions work. While you may have been asked to do this, it doesn’t really make sense.
Depending how permissions are managed, the current user could have access to content on the current site by being a member of one group – or hundreds. Because of this, there really isn’t a group to display.
M.