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
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
- $bcc_address
-
(Required) Either an 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'
Return
(BP_Email)
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 BuddyPress 2.5.0
*
* @param BP_Email_Recipient[] $bcc BCC recipients.
* @param string|array|int|WP_User $bcc_address Either an 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;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.5.0 | 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.