BP_Email::set_cc( string|array|int|WP_User $cc_address, string $name = '', string $operation = 'replace' )
Set the email’s “cc” 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
- $cc_address
-
(Required) Either an email address, user ID, WP_User object, or an array containing any combination of the above.
- $name
-
(Optional) If $cc_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
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | public function set_cc( $cc_address , $name = '' , $operation = 'replace' ) { $cc = ( $operation !== 'replace' ) ? $this ->cc : array (); if ( is_array ( $cc_address ) ) { foreach ( $cc_address as $address ) { $cc [] = new BP_Email_Recipient( $address ); } } else { $cc [] = new BP_Email_Recipient( $cc_address , $name ); } /** * Filters the new value of the email's "CC" property. * * @since BuddyPress 2.5.0 * * @param BP_Email_Recipient[] $cc CC recipients. * @param string|array|int|WP_User $cc_address Either an email address, user ID, WP_User object, * or an array containing any combination of the above. * @param string $name Optional. If $cc_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 ->cc = apply_filters( 'bp_email_set_cc' , $cc , $cc_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.