bp_rest_get_user( int $user_id )

Get the user object, if the ID is valid.

Description

Parameters

$user_id

(int) (Required) Supplied user ID.

Return

(WP_User|boolean)

Source

File: bp-core/bp-core-rest-api.php

function bp_rest_get_user( $user_id ) {
	if ( (int) $user_id <= 0 ) {
		return false;
	}

	$user = get_userdata( (int) $user_id );
	if ( empty( $user ) || ! $user->exists() ) {
		return false;
	}

	return $user;
}

Changelog

Changelog
Version Description
BuddyBoss 1.3.5 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.