Flag / Unflag User feature is an essential tool for maintaining a safe and engaging chat community. With social.plus, you can use the flag and unflag user feature to allow moderators and administrators to monitor any inappropriate behavior within a chat channel. In this section, we will discuss how to use the flag and unflag user feature of social.plus Chat SDK to maintain a safe and engaging chat community.
Flagging a user helps moderators identify potential issues without immediately taking action. It’s a reporting mechanism that requires admin review.

How User Flagging Works

Flag User

Report users for inappropriate behavior

Unflag User

Remove flags when issues are resolved

Check Status

Verify if you’ve flagged a specific user

Flag a User

To flag a user, call the following method:
do {
    let unflagged = try await userRepository.flagUser(withId: "<user-id>")
} catch {
    // Handle error here
}

Unflag a User

To unflag a user, call the following method:
do {
    let unflagged = try await userRepository.unflagUser(withId: "<user-id>")
} catch {
    // Handle error here
}

Check Flagged By User

To check whether a user has been flagged by the current user:
do {
    let isFlaggedByMe = try await userRepository.isUserFlaggedByMe(withId: "<user-id>")
} catch {
    // Handle error here
}

Best Practices

Next Steps