Skip to content

Instantly share code, notes, and snippets.

@adczk
Created February 7, 2022 14:21
Show Gist options
  • Save adczk/755d069e7afbe928f5072aedfa73cd5b to your computer and use it in GitHub Desktop.
Save adczk/755d069e7afbe928f5072aedfa73cd5b to your computer and use it in GitHub Desktop.
Forminator - customize new user registration mail
<?php
/*****************************
*
* A very crude way to customize new user registration mail for Frominator
* use as MU plugin
*
* customize message in $new_message variable
* customize subject in $mail_args[ 'subject' ] = 'New subject"; line
*
* tested with Forminator 1.15.10
*
* by Adam/WPMU DEV
*
*******************************/
add_filter(
'forminator_custom_form_user_registration_before_insert',
function( $new_user_data ) {
add_filter(
'wp_mail',
function( $mail_args ) use ($new_user_data) {
$new_message = 'Hi, your username is: ' . $new_user_data['user_login'] . ' and your mail is: ' . $new_user_data['user_email'];
$mail_args[ 'subject' ] = 'New subject';
$mail_args[ 'message' ] = $new_message;
return $mail_args;
},
10,
3
);
return $new_user_data;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment