Manage user details

Get details about the app users.

icon

Usage in Blueprints and C++

Get user details

Return data about a specific user with the GetUser() method.

By default, this method returns all custom user metadata without the need to define that during the call explicitly.

Requires App Context

To store data about users, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

Output

TypeDescription
UPubnubUser*Returned object containing the user metadata or a null value if the user doesn't exist.

Basic usage

Get details on user support_agent_15.

#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);

Get current user

CurrentUser is a getter method that returns the current chat user of the chat app.

Requires App Context

To store data about users, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

Output

TypeDescription
UPubnubUser*Returned User object.

Basic usage

Return the current chat user.

#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->CurrentUser();

Get user ID

GetUserID is a getter method that returns the current chat user's ID.

Method signature

Output

TypeDescription
FString*Returned user ID.

Basic usage

Return the current chat user's ID.

#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->CurrentUser();

FString ReturnedUserID = User->GetUserID();

Get user data

GetUserData is a getter method that returns the current chat user's data.

Method signature

Output

TypeDescription
FPubnubChatUserData*Returned user data.

Basic usage

Return the current chat user's data.

#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->CurrentUser();

FPubnubChatUserData UserData = User->GetUserData();
Last updated on