um_fetch_user

Description

This function sets a user and allow you to retrieve any information for the retrieved user

Usage

<?php um_fetch_user( $user_id ); ?>

Parameters

$user_id

(numeric) (required) A user ID is required. This is the user’s ID that you wish to set/retrieve

Returns

Sets a specific user and prepares profile data and user permissions and makes them accessible.

Examples

The example below will set user ID 5 prior to retrieving his profile information.

<?php
um_fetch_user(5);
echo um_user('display_name'); // returns the display name of user ID 5
?>

In the following example you can fetch the profile of a logged-in user dynamically.

<?php
um_fetch_user( get_current_user_id() );
echo um_user('display_name'); // returns the display name of logged-in user
?>