• Resolved randyfuj

    (@randyfuj)


    Hi, is it possible to have the Account Approved email get sent to two separate addresses – the user’s address plus one additional address?

    Thank you for your help. Your plugin works great so far!

Viewing 1 replies (of 1 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    From the looks of it, we have the following filter available:

    $mailme_filtered = apply_filters( 'bpro_hook_before_email', $mailme, $user );
    

    It is run right before the sending of the email to all users who were just approved. Once for each user.

    https://github.com/WebDevStudios/BuddyPress-Registration-Options/blob/master/includes/admin.php#L201-L207

    Based on developer.www.ads-software.com, the wp_mail function takes an array/string for the first field, which is where the email gets set. However, it also notes that it’ll take a comma separated value of multiple emails.

    You’d need to work out how to grab the secondary email you want things sent to, but you could do something like the following:

    
    function email_many_people( $mailme, $user_object ) {
        // For clarity, the $user_object variable is the WP_User object for the approved user.
        /**
         * Do some querying here to grab the email.
         * Our example stores it in the variable $some_email_variable
         */
        $mailme['user_email'] .= ',' . $some_email_variable;
    
        // This would append the value in $some_email_variable to the end of the string value stored in the array index.
    
        return $mailme;
    }
    add_filter( 'bpro_hook_before_email', 'email_many_people', 10, 2 );
    

    Give it a go and see what you can achieve with this.

Viewing 1 replies (of 1 total)
  • The topic ‘Account Approved Email’ is closed to new replies.