Adding and Removing a Member
Users can be added to groups and removed from groups.
Adding a member
A group owner can add additional members to their group:
-
// Instantiate a user. var user2 = KiiUser.userWithURI("Set the URI of an existing user here"); // Add the user to the group. group.addUser(user2); // Save the group on the server. group.save().then( function(theGroup) { // Do something. } ).catch( function(error) { // Handle the error. var theGroup = error.target; var errorString = error.message; var addMembersArray = error.addMembersArray; } );
-
// Instantiate a user. var user2 = KiiUser.userWithURI("Set the URI of an existing user here"); // Add the user to the group. group.addUser(user2); // Save the group on the server. group.save({ success: function(theGroup) { // Do something. }, failure: function(theGroup, errorString, addMembersArray) { // Handle the error. } });
Make sure to execute the save()
method to reflect the changes.
Removing a member
A group owner can remove existing members from their group:
-
// Instantiate a user. var user2 = KiiUser.userWithURI("Set the URI of an existing user here"); // Remove the user from the group. group.removeUser(user2); // Save the group on the server. group.save().then( function(theGroup) { // Do something. } ).catch( function(error) { // Handle the error. var theGroup = error.target; var errorString = error.message; var removeMembersArray = error.removeMembersArray; } );
-
// Instantiate a user. var user2 = KiiUser.userWithURI("Set the URI of an existing user here"); // Remove the user from the group. group.removeUser(user2); // Save the group on the server. group.save({ success: function(theGroup) { // Do something. }, failure: function(theGroup, errorString, addMembersArray, removeMembersArray) { // Handle the error. } });
Make sure to execute the save()
method to reflect the changes.