Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

  • alwaysalready
    Participant

    @alwaysalready

    Thank you @nqui and @coolhunt. Glad it’s been helpful. @shanebp, I’ll look into adding it to the codex. Thank you for the suggestion.


    alwaysalready
    Participant

    @alwaysalready

    I found a way to resolve this problem using a mixture of ideas others have shared (including @6logics and @loveplove). I’ve put the details in a blog post here. In summary, what worked for me was the following in the bp-custom.php file:

    // Set BP to use wp_mail
    add_filter( 'bp_email_use_wp_mail', '__return_true' );
     
    // Set messages to HTML
    remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
    add_filter( 'wp_mail_content_type', 'set_html_content_type' );
    function set_html_content_type() {
        return 'text/html';
    }
     
    // Use HTML template
    add_filter( 'bp_email_get_content_plaintext', 'get_bp_email_content_plaintext', 10, 4 );
    function get_bp_email_content_plaintext( $content = '', $property = 'content_plaintext', $transform = 'replace-tokens', $bp_email ) {
        if ( ! did_action( 'bp_send_email' ) ) {
            return $content;
        }
        return $bp_email->get_template( 'add-content' );
    }
    //Optionally remove the filter above after it's run
    remove_filter('wp_mail','redirect_mails',20);
     
    // Optionally change your email address
    add_filter('wp_mail_from','noreply_from');
    function noreply_from($from) {
      return 'noreply@YOUR_DOMAIN.org'; //Replace 'YOUR_DOMAIN.org' with email address
    }
    
    // Optionally change your from name
    add_filter('wp_mail_from_name','noreply_from_name');
    function noreply_from_name($name) {
        return 'YOUR_DOMAIN No-Reply'; //Replace 'YOUR_DOMAIN No-Reply' with the from name
    }

    alwaysalready
    Participant

    @alwaysalready

    I found a way to resolve this problem using a mixture of ideas others have shared elsewhere. I’ve put the details in a blog post here. In summary, what worked for me was the following in the bp-custom.php file:

    // Set BP to use wp_mail
    add_filter( 'bp_email_use_wp_mail', '__return_true' );
     
    // Set messages to HTML
    remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
    add_filter( 'wp_mail_content_type', 'set_html_content_type' );
    function set_html_content_type() {
        return 'text/html';
    }
     
    // Use HTML template
    add_filter( 'bp_email_get_content_plaintext', 'get_bp_email_content_plaintext', 10, 4 );
    function get_bp_email_content_plaintext( $content = '', $property = 'content_plaintext', $transform = 'replace-tokens', $bp_email ) {
        if ( ! did_action( 'bp_send_email' ) ) {
            return $content;
        }
        return $bp_email->get_template( 'add-content' );
    }
    //Optionally remove the filter above after it's run
    remove_filter('wp_mail','redirect_mails',20);
     
    // Optionally change your email address
    add_filter('wp_mail_from','noreply_from');
    function noreply_from($from) {
      return 'noreply@YOUR_DOMAIN.org'; //Replace 'YOUR_DOMAIN.org' with email address
    }
    
    // Optionally change your from name
    add_filter('wp_mail_from_name','noreply_from_name');
    function noreply_from_name($name) {
        return 'YOUR_DOMAIN No-Reply'; //Replace 'YOUR_DOMAIN No-Reply' with the from name
    }

    alwaysalready
    Participant

    @alwaysalready

    I found a way to resolve this problem using a mixture of ideas, including the suggestions from @bharat and @vbnr. I’ve put the details in a blog post here. In summary, what worked for me was the following in the bp-custom.php file:

    // Set BP to use wp_mail
    add_filter( 'bp_email_use_wp_mail', '__return_true' );
     
    // Set messages to HTML
    remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
    add_filter( 'wp_mail_content_type', 'set_html_content_type' );
    function set_html_content_type() {
        return 'text/html';
    }
     
    // Use HTML template
    add_filter( 'bp_email_get_content_plaintext', 'get_bp_email_content_plaintext', 10, 4 );
    function get_bp_email_content_plaintext( $content = '', $property = 'content_plaintext', $transform = 'replace-tokens', $bp_email ) {
        if ( ! did_action( 'bp_send_email' ) ) {
            return $content;
        }
        return $bp_email->get_template( 'add-content' );
    }
     
    // Optionally change your email address and from name.
    add_filter('wp_mail_from','noreply_from');
    function noreply_from($from) {
      return 'noreply@YOUR_DOMAIN.org'; //Replace 'YOUR_DOMAIN.org' with email address
    }
     
    add_filter('wp_mail_from_name','noreply_from_name');
    function noreply_from_name($name) {
        return 'YOUR_DOMAIN No-Reply'; //Replace 'YOUR_DOMAIN No-Reply' with the from name
    }
Viewing 4 replies - 1 through 4 (of 4 total)
Skip to toolbar