BP_Email_Recipient::get_user( string $transform = 'raw' )

Get WP_User object for this recipient.


Description Description


Parameters Parameters

$transform

(Optional) How to transform the return value. Accepts 'raw' (default) or 'search-email'.

Default value: 'raw'


Top ↑

Return Return

(WP_User|null) WP_User object, or null if not set.


Top ↑

Source Source

File: bp-core/classes/class-bp-email-recipient.php

	public function get_user( $transform = 'raw' ) {

		// If transform "search-email", find the WP_User if not already set.
		if ( $transform === 'search-email' && ! $this->user_object && $this->address ) {
			$this->user_object = get_user_by( 'email', $this->address );
		}

		/**
		 * Filters the WP_User object for this recipient before it's returned.
		 *
		 * @since 2.5.0
		 *
		 * @param WP_User $name WP_User object for this recipient, or null if not set.
		 * @param string $transform Optional. How the return value was transformed.
		 *                          Accepts 'raw' (default) or 'search-email'.
		 * @param BP_Email $recipient $this Current instance of the email recipient class.
		 */
		return apply_filters( 'bp_email_recipient_get_user', $this->user_object, $transform, $this );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.