social.plus Community Moderation provides comprehensive tools for managing community roles, permissions, and enforcement actions. This system ensures healthy community environments through role-based access control, permission management, and enforcement capabilities, allowing creators and administrators to maintain effective community governance.

Role Management

Add and remove roles from community members with flexible permissions

Enforcement Tools

Ban and unban users to maintain community standards

Permission System

Check user permissions for granular access control

Administrative Control

Complete moderation toolkit for community governance

Add Roles

The addRoles() function assigns existing roles to community members, providing flexible role-based access control. This function supports both default roles and custom roles configured in your community.

Parameters

ParameterTypeRequiredDescription
rolesString[]YesArray of role names to assign
userIdsString[]YesArray of user IDs to receive the roles
communityIdStringYesID of the target community
do {
    let success = try await communityModeratiom.addRoles(roles, userIds: userIds)
} catch {
    // Handle error here
}

Remove Roles

The removeRoles() function removes existing roles from community members. This function allows selective role removal while maintaining other assigned roles for the specified users.

Parameters

ParameterTypeRequiredDescription
rolesString[]YesArray of role names to remove
userIdsString[]YesArray of user IDs to remove roles from
communityIdStringYesID of the target community
do {
    let success = try await communityModeratiom.removeRoles(roles, userIds: userIds)
} catch {
    // Handle error here
}

Ban Members

The banMembers() function allows community creators and moderators to ban multiple members simultaneously. This provides an efficient way to enforce community rules and restrict access for users who violate community standards.

Parameters

ParameterTypeRequiredDescription
userIdsString[]YesArray of user IDs to ban from the community
communityIdStringYesID of the target community
do {
    let isBanned = try await communityModeratiom.banMembers(["userId-1", "userId-2"])
} catch {
    // Handle error here
}

Unban Members

The unbanMembers() function removes bans from previously banned community members. This feature is useful when banned members have corrected their behavior and are ready to rejoin the community.

Parameters

ParameterTypeRequiredDescription
userIdsString[]YesArray of user IDs to unban from the community
communityIdStringYesID of the target community
do {
    let isUnBanned = try await communityModeratiom.unbanMembers(["userId-1", "userId-2"])
} catch {
    // Handle error here
}

Permission Checking

The hasPermission() method provides a convenient way to check user permissions within a community. Use this method to implement proper access control and conditional UI elements based on user capabilities.

Parameters

ParameterTypeRequiredDescription
permissionEnumYesPermission type to check
communityIdStringYesID of the target community

Available Permissions

PermissionDescription
ADD_COMMUNITY_USERAdd members to community
REMOVE_COMMUNITY_USERRemove members from community
BAN_USERBan users from community
EDIT_COMMUNITYEdit community settings
DELETE_COMMUNITYDelete the community
MANAGE_COMMUNITY_USERManage user roles and permissions
client.hasPermission(.addCommunityUser, forCommunity: "<community-id>") { hasPermission in
    // Handle the result
}

Moderation Rules

Role Hierarchy

  • Community Creator: Automatically assigned moderator role, cannot be removed as last moderator
  • Moderators: Can manage members, assign/remove roles, and enforce community rules
  • Members: Standard community access with basic participation rights

Permission Requirements

  • Add/Remove Roles: Moderator or Administrator permissions required
  • Ban/Unban Members: Moderator or Administrator permissions required
  • Permission Checks: Available to all authenticated users

Important Limitations

  • The last moderator cannot leave a community without assigning another moderator
  • Community creators are automatically assigned moderator roles
  • Role operations apply to Community and Live channels only (not Conversation channels)
  • Permissions are evaluated in real-time and may change based on role updates