Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/06/2019 04:31:35 PM (3 years ago)
Author:
boonebgorges
Message:

Emails: Improve performance when setting Reply-To and From headers.

The new BP_Email_Participant framework allows the Reply-To and From email
headers to be set without requiring an empty and potentially expensive WP
user lookup.

Fixes #8003.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-email.php

    r12284 r12353  
    6666     * @since 2.5.0
    6767     *
    68      * @var BP_Email_Recipient Sender details.
     68     * @var BP_Email_Sender Sender details.
    6969     */
    7070    protected $from = null;
     
    102102     * @since 2.5.0
    103103     *
    104      * @var BP_Email_Recipient "Reply to" details.
     104     * @var BP_Email_Sender "Reply to" details.
    105105     */
    106106    protected $reply_to = null;
     
    431431     * @param string $transform Optional. How to transform the return value.
    432432     *                          Accepts 'raw' (default) or 'replace-tokens'.
    433      * @return BP_Email_Recipient "From" recipient.
     433     * @return BP_Email_Sender "From" recipient.
    434434     */
    435435    public function get_from( $transform = 'raw' ) {
     
    739739     */
    740740    public function set_from( $email_address, $name = '' ) {
    741         $from = new BP_Email_Recipient( $email_address, $name );
     741        $from = new BP_Email_Sender();
     742
     743        $from->set_address( $email_address );
     744        $from->set_name( $name );
    742745
    743746        /**
     
    811814     */
    812815    public function set_reply_to( $email_address, $name = '' ) {
    813         $reply_to = new BP_Email_Recipient( $email_address, $name );
     816        $reply_to = new BP_Email_Sender();
     817
     818        $reply_to->set_address( $email_address );
     819        $reply_to->set_name( $name );
    814820
    815821        /**
Note: See TracChangeset for help on using the changeset viewer.