Getting the Owner of a Group
You can get the group owner with the getOwner()
method.
Note that the KiiUser
instance returned by the method only contains the ID
. Execute the refresh()
method to get the user's latest information from Kii Cloud.
If the returned user is different from the logged-in user, available user information is limited. For more information, see User Attributes.
The following sample code shows how to get the group owner.
-
// Get the owner user of members of the group. group.getOwner().then( function(params) { var group = params[0]; var owner = params[1]; // Refresh the owner to retrieve the latest data from Kii Cloud. return owner.refresh(); } ).then( function(owner) { // Do something. } ).catch( function(error) { // Handle the error. // Get the group for the failed getOwner() method. var thrGroup = error.target; // Get the user for the failed refresh() method. var theUser = error.target; // Get the error message. var errorString = error.message; } );
-
// Get the owner user of the group. group.getOwner({ success: function(theGroup, owner) { // Refresh the owner to retrieve the latest data from Kii Cloud. owner.refresh({ success: function(theUser) { // Do something. }, failure: function(theUser, errorString) { // Handle the error. } }); }, failure: function(theGroup, errorString) { // Handle the error. } });