Need to send an email to 2 addresses

In the Membership 2 plugin, when a new member pays for their membership, we need to have 2 email addresses receive the email. But the field where you put the address only allows one entry.

  • Ivan

    Hi randomblink !

    You can create MU plugin for that (for example, create {wordpress_folder}/wp-content/mu-plugins/wpmu_membershir2_add_recipients.php file via FTP) with the following code

    <?php
    
    function wpmu_membershir2_add_recipients( $recipients, $obj, $subscription ) {
        if ( !empty( $obj->type ) && 'type_registration' === $obj->type ) {
            $recipients[] = 'you_email1@domain.com';
            $recipients[] = 'you_email2@domain.com';
        }
        return array_unique( $recipients );
    }
    add_filter( 'ms_model_communication_send_message_recipients', 'wpmu_membershir2_add_recipients', 10, 3 );

    Best regards,
    Ivan.