On this page

Delete users

Remove users with DeleteUser().

icon

Usage in Blueprints and C++


  • User->DeleteUser() - call on a User object (no ID needed)
  • Chat->DeleteUser() - call on a Chat object (requires user ID)
Requires App Context

Enable App Context in the Admin Portal to store user data.

Delete a user (hard delete)

Method signature

Output

These methods don't return any value.

Sample code

Delete user support_agent_15.

  • User->DeleteUser()

    1#include "Kismet/GameplayStatics.h"
    2#include "PubnubChatSubsystem.h"
    3
    4UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
    5UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
    6
    7UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
    8
    9// Define user ID
    10FString UserID = "support_agent_15";
    11
    12// Get the user and save the reference
    13UPubnubUser* User = Chat->GetUser(UserID);
    14
    15User->DeleteUser();
  • Chat->DeleteUser()

    1#include "Kismet/GameplayStatics.h"
    2#include "PubnubChatSubsystem.h"
    3
    4UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
    5UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
    6
    7UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
    8
    9Chat->DeleteUser("support-agent-15");
Last updated on