BP_Email::set_bcc( string|array|int|WP_User $bcc_address, string $name = '', string $operation = 'replace' )

Set the email’s “bcc” address and name.


Description Description

To set a single address, the first parameter is the address and the second the name. You can also pass a user ID or a WP_User object.

To set multiple addresses, for each array item, the key is the email address and the value is the name.


Parameters Parameters

$bcc_address

(Required) Either a email address, user ID, WP_User object, or an array containing any combination of the above.

$name

(Optional) If $bcc_address is a string, this is the recipient's name.

Default value: ''

$operation

(Optional) If "replace", $to_address replaces current setting (default). If "add", $to_address is added to the current setting.

Default value: 'replace'


Top ↑

Return Return

(BP_Email)


Top ↑

Source Source

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

	public function set_bcc( $bcc_address, $name = '', $operation = 'replace' ) {
		$bcc = ( $operation !== 'replace' ) ? $this->bcc : array();

		if ( is_array( $bcc_address ) ) {
			foreach ( $bcc_address as $address ) {
				$bcc[] = new BP_Email_Recipient( $address );
			}

		} else {
			$bcc[] = new BP_Email_Recipient( $bcc_address, $name );
		}

		/**
		 * Filters the new value of the email's "BCC" property.
		 *
		 * @since 2.5.0
		 *
		 * @param BP_Email_Recipient[] $bcc BCC recipients.
		 * @param string|array|int|WP_User $bcc_address Either a email address, user ID, WP_User object,
		 *                                              or an array containing any combination of the above.
		 * @param string $name Optional. If $bcc_address is a string, this is the recipient's name.
		 * @param string $operation If "replace", $to_address replaced previous recipients. If "add",
		 *                          $to_address was added to the array of recipients.
		 * @param BP_Email $this Current instance of the email type class.
		 */
		$this->bcc = apply_filters( 'bp_email_set_bcc', $bcc, $bcc_address, $name, $operation, $this );

		return $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.