Skip to content

Instantly share code, notes, and snippets.

@max-kk
Last active May 27, 2023 07:11
Show Gist options
  • Save max-kk/396d7da80c722c0527b2810c8aaadc18 to your computer and use it in GitHub Desktop.
Save max-kk/396d7da80c722c0527b2810c8aaadc18 to your computer and use it in GitHub Desktop.
LRM :: extra_mail_args
<?php
// User Emails
add_filter("lrm/mails/registration/body", function($mail_body, $user_login, $userdata, $user) {
// Let's replace the {{USER_PHONE}} tag with user meta value
$mail_body = str_replace( '{{USER_PHONE}}', get_user_meta($user->ID, 'phone', true), $mail_body );
return $mail_body;
}, 10, 4);
//$mail_body = apply_filters("lrm/mails/registration/body", $mail_body, $user->user_login, $userdata, $user);
// Admin Emails
add_filter("lrm/mails/registration_to_admin/body", function($mail_body, $user_login, $userdata, $user) {
// Let's replace the {{USER_PHONE}} tag with user meta value
$mail_body = str_replace( '{{USER_PHONE}}', get_user_meta($user->ID, 'phone', true), $mail_body );
return $mail_body;
}, 10, 4);
<?php
//$mail_body = apply_filters("lrm/mails/registration/body", $mail_body, $user->user_login, $userdata, $user);
// FOr Admin Email use "lrm/mails/registration_to_admin/body"
add_filter("lrm/mails/registration/body", function($mail_body, $user_login, $userdata, $user) {
// Let's replace the {{USER_PHONE}} tag with user meta value
$mail_body = str_replace( '{{USER_PHONE}}', $_POST['phone'], $mail_body );
return $mail_body;
}, 10, 4);
@priyankrawat
Copy link

This is not working, my custom fields are getting saved on the backend but not able to send them in email.

@gdrebes
Copy link

gdrebes commented Oct 14, 2020

+1 Not working here. Would love to have the custom field in the admin Mail. Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment