Delete users
Unreal Chat SDK lets you remove an existing USER using the DeleteUser()
methods.
Both of these methods give the same output. The only difference is that you call a given method either on the Chat
or the User
object. Depending on the object, these methods take a different set of input parameters - you either have to specify the user ID you want to delete or not because it's already known.
Requires App Context
To store data about users, you must enable App Context for your app's keyset in the Admin Portal.
Delete a user (hard delete)
Method signature
- Blueprint
- C++ / Input parameters
-
User->DeleteUser()
User->DeleteUser()
-
Chat->DeleteUser()
Chat->DeleteUser(FString UserID)
Parameter | Type | Required in User->DeleteUser() | Required in Chat->DeleteChannel() | Default | Description |
---|---|---|---|---|---|
ChannelID | FString | No | Yes | n/a | Unique user identifier (up to 92 UTF-8 characters). |
Output
These methods don't return any value.
Basic usage
Delete user support_agent_15
.
-
User->DeleteUser()
#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
// Define user ID
FString UserID = "support_agent_15";
// Get the user and save the reference
UPubnubUser* User = Chat->GetUser(UserID);
User->DeleteUser(); -
Chat->DeleteUser()
#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
Chat->DeleteUser("support-agent-15");