WordPress at a glance
function is not described

sanitize_user_object() WP 2.3.0

Deprecated in 3.3.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Sanitize every user field.

If the context is 'raw', then the user object or array will get minimal santization of the int fields.

No Hooks.

Return

Object/Array. The now sanitized User Object or Array (will be the same type as $user)

Usage

sanitize_user_object( $user, $context );
$user(object/array) (required)
The User Object or Array
$context(string)
How to sanitize user fields.
Default: 'display'

Changelog

Since DEL 3.3.0 Introduced.

Code of sanitize user object: wp-includes/deprecated.php WP 5.2.3

<?php
function sanitize_user_object($user, $context = 'display') {
	_deprecated_function( __FUNCTION__, '3.3.0' );

	if ( is_object($user) ) {
		if ( !isset($user->ID) )
			$user->ID = 0;
		if ( ! ( $user instanceof WP_User ) ) {
			$vars = get_object_vars($user);
			foreach ( array_keys($vars) as $field ) {
				if ( is_string($user->$field) || is_numeric($user->$field) )
					$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
			}
		}
		$user->filter = $context;
	} else {
		if ( !isset($user['ID']) )
			$user['ID'] = 0;
		foreach ( array_keys($user) as $field )
			$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
		$user['filter'] = $context;
	}

	return $user;
}