---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/users/details
title: Manage user details
updated_at: 2026-06-15T09:14:19.675Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Manage user details

Retrieve user details from your app.

##### Usage in Blueprints and C++

You can use PubNub's functionality via Blueprints or directly in C++ code.

* In Blueprints, you can access PubNub from any Widget or Actor. Start by [initializing chat](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/configuration#initialize-pubnub-chat) using `InitChat` on `UPubnubChatSubsystem`. Afterwards, you can use the returned `UPubnubChat` object reference to call all Chat SDK functions.

:::warning Blueprint functions
The Blueprints provided in the documentation show how you can structure your application and may contain utility methods and elements like buttons that are not part of the Unreal Chat SDK and are meant to serve as guidance.
:::

* In C++, you can use UPubnubChatSubsystem as any other Game Instance Subsystem. #include "Kismet/GameplayStatics.h" #include "Engine/GameInstance.h" #include "PubnubChatSubsystem.h" // ACTION REQUIRED: Replace ASample_ChatSubsystem with name of your Actor class void ASample_ChatSubsystem::InitChatSample() { // Get PubnubChatSubsystem from GameInstance UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this); UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>(); // Initialize Chat - InitChat may fail under some conditions so make sure to check the Result for errors before using the Chat FPubnubChatInitChatResult InitChatResult = PubnubChatSubsystem->InitChat(TEXT("demo"), TEXT("demo"), TEXT("Player_001")); UPubnubChat* PubnubChat = InitChatResult.Chat; } Chat now allows you to call all Chat SDK functions, for example, Chat->GetChannel("my_channel").

:::note Asynchronous and synchronous method execution
Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.
* Asynchronous methods (Async suffix) return void and take an optional delegate parameter that fires when the operation completes. 1Chat->GetUserAsync(UserID, OnGetUserResponseDelegate); You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatUserResponseNative).
* Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly. 1FPubnubChatUserResult Result = Chat->GetUser(UserID);
:::

## Get user details

`GetUser()` returns data about a specific user, including all custom metadata by default.

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) in the [Admin Portal](https://admin.pubnub.com/) to store user data.
:::

### Method signature

#### C++ / Input parameters

```cpp
Chat->GetUser(FString UserID)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| UserID | FString | Yes |  | [Unique user identifier](https://www.pubnub.com/docs/general/setup/users-and-devices#user-id-usage). |

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatUserResult` | Returned object containing `Result` (`FPubnubChatOperationResult`) and `User` (`UPubnubChatUser*`). The user is `nullptr` if not found. |

### Sample code

:::tip Reference code
This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with `ACTION REQUIRED` before running the code. Use it as a reference when working with other examples in this document.
:::

Fetch a user by ID asynchronously.

###### C++

###### Actor.h

```cpp
// blueprint._5hbneb_
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|Chat|User")
void GetUserSample();

UFUNCTION()
void OnGetUserResponse(const FPubnubChatUserResult& Result);
```

###### Actor.cpp

```cpp
#include "PubnubChatUser.h"

// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
void ASample_Chat::GetUserSample()
{
	// snippet.hide
	UPubnubChat* Chat = nullptr;
	// snippet.show

	// Assumes Chat is a valid and initialized instance of UPubnubChat

	// Bind a callback with signature matching FOnPubnubChatUserResponseNative, then call Async
	FOnPubnubChatUserResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
	Callback.BindUObject(this, &ASample_Chat::OnGetUserResponse);
	Chat->GetUserAsync(TEXT("Player_002"), Callback);
}

// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
void ASample_Chat::OnGetUserResponse(const FPubnubChatUserResult& Result)
{
	if (Result.Result.Error) { return; }
	UPubnubChatUser* OtherUser = Result.User;
	FString OtherDisplayName = OtherUser->GetUserData().UserName;
}
```

###### Blueprint

## Get current user

`GetCurrentUser()` returns the current chat user.

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) in the [Admin Portal](https://admin.pubnub.com/) to store user data.
:::

### Method signature

#### C++ / Input parameters

```cpp
Chat->GetCurrentUser();
```

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| `UPubnubChatUser*` | Returned [User object](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/user). |

### Sample code

Return the current chat user.

#### C++

```cpp
#include "PubnubChatUser.h"

// ACTION REQUIRED: Replace ASample_Chat with name of your Actor class
void ASample_Chat::GetCurrentUserSample()
{
	// snippet.hide
	UPubnubChat* Chat = nullptr;
	// snippet.show
	
	// Assumes Chat is a valid and initialized instance of UPubnubChat

	// Get the current chat user (local, no network call — the player who owns this chat session)
	UPubnubChatUser* CurrentUser = Chat->GetCurrentUser();
	if (CurrentUser)
	{
		// Use CurrentUser for display name, avatar URL, or to fetch memberships
		FString DisplayName = CurrentUser->GetUserData().UserName;
	}
}
```

#### Blueprint

## Get user ID

`GetUserID()` returns the current chat user's ID.

### Method signature

#### C++ / Input parameters

```cpp
User->GetUserID();
```

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| `FString` | Returned user ID. |

### Sample code

Return the current chat user's ID.

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::GetUserIDSample()
{
	// snippet.hide
	UPubnubChatUser* User = nullptr;
	// snippet.show

	// Assumes User is a valid UPubnubChatUser (e.g. from GetUser)

	// Get the user ID (local, no network call)
	FString UserID = User->GetUserID();
}
```

#### Blueprint

## Get user data

`GetUserData()` returns the current chat user's data.

### Method signature

#### C++ / Input parameters

```cpp
User->GetUserData();
```

#### Blueprint

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatUserData` | Returned [user data](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/user) from the local cache. |

### Sample code

Return the current chat user's data.

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatUser with name of your Actor class
void ASample_ChatUser::GetUserDataSample()
{
	// snippet.hide
	UPubnubChatUser* User = nullptr;
	// snippet.show

	// Assumes User is a valid UPubnubChatUser (e.g. from GetUser)

	// Get user metadata from local cache (local, no network call)
	FPubnubChatUserData UserData = User->GetUserData();
	FString UserName = UserData.UserName;
}
```

#### Blueprint