メインコンテンツまでスキップ

Activate profanity filter for validation

Last updated on November 1, 2024

Introduction

This article walks you through how to activate the profanity filter in your namespace to validate the display names and usernames of your players.

備考
  • The profanity filter feature currently only validates the usernames and display names of your players.
  • Currently, you can only create custom profanity filters on the Admin Portal. The option to use default filters provided by AGS will be added soon.

Prerequisites

  • You have created and configured a designated profanity filter Extend App or set up your own custom server.
  • You have created custom profanity filters in the Admin Portal. See Create and manage custom profanity filters.

Activate profanity filter for display name validation

To activate the profanity filter to validate the display names of your players, follow these steps:

  1. In the AGS Admin Portal, select Admin Task > IAM Input Validation on the sidebar menu.

  2. In the Display Name section, turn on the Profanity filter toggle.

  3. After activating the Profanity filter toggle, select the database filter that will be used from the Profanity database dropdown. The database filter options are from the custom filters in your namespace. See Create custom filters.

    profanity filter on display name

    備考

    Currently, you can only choose from your custom filters. The option to choose from a set of default filters provided by AGS will be added soon.

  4. Click Save.

Activate profanity filter for username validation

To activate the profanity filter to validate the usernames of your players, follow these steps:

  1. In the AGS Admin Portal, select Admin Task > IAM Input Validation on the sidebar menu.

  2. In the Username section, turn on the Profanity filter toggle.

  3. After activating the Profanity filter toggle, select the database filter that will be used from the Profanity database dropdown. The database filter options are from the custom filters in your namespace. See Create custom filters.

    profanity filter on username

    備考

    Currently, you can only choose from your custom filters. The option to choose from a set of default filters provided by AGS will be added soon.

  4. Click Save.

Implement profanity filter with client SDKs

The validate user endpoint is contained inside the user class of the object for both Unreal OSS and SDK.

Validate user input

To enable this endpoint, specify the FUserInputValidationRequest model to put it into the parameter function. AGS has several validations including Username, DisplayName, or UniqueDisplayName. If the response is valid, then it will return true. Otherwise, it will return false with an error message.

FUserInputValidationRequest UserInputValidationRequest{};
UserInputValidationRequest.Username = "badwordsexample";
FUserInputValidationResponse UserInputValidationResponse{};
FRegistry::User.ValidateUserInput(UserInputValidationRequest, THandler<FUserInputValidationResponse>::CreateLambda([&](const FUserInputValidationResponse& Response)
{
UE_LOG(LogAccelByteUserServiceTest, Log, TEXT("Success"));
}), FErrorHandler::CreateLambda([&](int32 ErrorCode, const FString& ErrorMessage)
{
UE_LOG(LogAccelByteUserServiceTest, Warning, TEXT("Error Code: %d, Reason: %s"), ErrorCode, *ErrorMessage);
}));