Skip to:
Content

BuddyPress.org

Ticket #7286: 7286.1.patch

File 7286.1.patch, 916 bytes (added by dcavins, 3 years ago)

Add a filter on $phpmailer before loading the standard version in BP_PHPMailer

  • src/bp-core/classes/class-bp-phpmailer.php

    diff --git src/bp-core/classes/class-bp-phpmailer.php src/bp-core/classes/class-bp-phpmailer.php
    index bfb2c74..4d6b88b 100644
    class BP_PHPMailer implements BP_Email_Delivery { 
    2727        public function bp_email( BP_Email $email ) {
    2828                static $phpmailer = null;
    2929
    30                 if ( $phpmailer === null ) {
     30                /**
     31                 * Filter PHPMailer class to use.
     32                 *
     33                 * Specify an alternative version of PHPMailer before BP loads the default version.
     34                 *
     35                 * @since 2.8.0
     36                 *
     37                 * @param string $phpmailer The phpmailer class.
     38                 */
     39                $phpmailer = apply_filters( 'bp_send_email_phpmailer_class', $phpmailer );
     40
     41                if ( ! ( $phpmailer instanceof PHPMailer ) ) {
    3142                        if ( ! class_exists( 'PHPMailer' ) ) {
    3243                                require_once ABSPATH . WPINC . '/class-phpmailer.php';
    3344                                require_once ABSPATH . WPINC . '/class-smtp.php';