Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Buddypress default email


  • jessicana
    Participant

    @jessicana

    Hello

    I used a code in my child theme functions.php to change the code at registration and it worked, that code was:
    //Change username and email at registration
    // changing from name

    function rv_mail_from_name($name) {
        return 'Enter your Site Name Here';
    }
    // changing email
    function rv_mail_from($content_type) {
        return 'no-reply@Enter-your-domain-here.com';
    }
    
    add_filter('wp_mail_from','rv_mail_from');
    add_filter('wp_mail_from_name','rv_mail_from_name');

    Private messages notifications via email is still showing wordpress@domainname, to change this, I used:

    function custom_wp_mail_from( $email ) {
        $handle = 'no-reply';
        $find = 'http://';
        $replace = '';
        $link = get_bloginfo( 'url' );
        $domain = str_replace( $find, $replace, $link );
        return $handle . '@' . $domain ;
    }
    add_filter( 'wp_mail_from', 'custom_wp_mail_from' );

    This still doesn’t work, I appreciate any help to change the notifications email through a child theme functions.php.

    Regards

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

  • Henry Wright
    Moderator

    @henrywright

    So wp_mail_from works for all email notifications aside from private message email notifications? If that’s the case then this is likely a bug. You could open a ticket for this on Trac.


    shanebp
    Moderator

    @shanebp

    Since BP 2.5.0, BP Emails use a different hook for that.
    Try:
    add_action( 'bp_email', function( $email_type, $email_obj ) { $email_obj->set_from( "no-reply@Enter-your-domain-here.com", "Enter your Site Name Here" ); }, 10, 2 );


    jessicana
    Participant

    @jessicana

    @shanebp

    This worked. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar