I am using SPServices to list out each permission group and then under each group, each user is listed out. Next to the user, there is a button that will be used to remove that user (and later, another to add a user).
The members are listed after the groups are built. groupString and groupTitle are brought in from building groups:
function listMembers(groupString, groupTitle) { var groupStringx = groupString; groupStringx = '#' + groupString; $().SPServices({ operation: "GetUserCollectionFromGroup", async: false, webURL: "website.name", groupName: groupTitle, completefunc: function(xData, Status){ $(xData.responseXML).find("User").each(function(){ userName = $(this).attr("LoginName").split('provider|')[1]; userArray.push([groupTitle, userName]); arrayLength = userArray.length-1; $(groupStringx).append( '<table style="width:900px;">' + '<tr>' + '<td class="userName" style="width:50%;">' + $(this).attr("Name") + '</td>' + '<td class="orgName" style="width:25%;"></td>' + '<td><div class="name" onclick="deleteClick(' + arrayLength + ')"' + '>GTFO</div></td>' + '</tr>' + '</table>' ); //end append });//end xdata }//end completefunc }); //end spservices GetUserCollectionFromGroup } Then when a user clicks "Remove" they trigger this function:
function deleteClick(arrayPos){ var group = userArray[arrayPos][0]; var user = userArray[arrayPos][1]; if (confirm("Are you sure you want to delete User from group?")) { deleteUserFromGroup(group, user); } } And the function contained within that one is:
function deleteUserFromGroup(group, user){ $().SPServices({ operation: "RemoveUserFromGroup", groupName: group, userLoginName: user, async: false, completefunc: null }); } The pop-up comes up, the parameters are passed successfully (after console.log testing), so I am not sure what I am missing here. Any help would be greatly appreciated!