Replies: 0
Hi I am trying to resolve this issue for last week but when I register a new person on account then it is showing critical error. You can check below-
2021/11/29 11:35:11 [error] 3492#3492: *24953 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to a member function get_billing_first_name() on null in /www/teliehealth_102/public/wp-content/themes/twentytwentyone-child/functions.php:1029
Stack trace:
#0 /www/teliehealth_102/public/wp-includes/class-wp-hook.php(305): new_customer_registered_send_email_admin(204731456)
#1 /www/teliehealth_102/public/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
#2 /www/teliehealth_102/public/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
#3 /www/teliehealth_102/public/wp-content/plugins/woocommerce/includes/wc-user-functions.php(105): do_action('woocommerce_cre...', 204731456, Array, false)
#4 /www/teliehealth_102/public/wp-content/plugins/woocommerce/includes/class-wc-form-handler.php(1092): wc_create_new_customer('anshu17@million...', 'anshu17', 'anshu@123')
#5 /www/teliehealth_102/public/wp-includes/class-wp-hook.php(303): WC_Form_Handler::process_registration('')
#6 /www/teliehealth_102/public/wp-includes/class-wp-hook" while reading response header from upstream, client: 217.20.116.185, server: teliehealth.kinsta.cloud, request: "POST /my-account/ HTTP/1.0", upstream: "fastcgi://unix:/var/run/php7.4-fpm-teliehealth.sock:", host: "teliehealth.kinsta.cloud", referrer: "https://teliehealth.kinsta.cloud/my-account/"
And the reference code for this error is-
function new_customer_registered_send_email_admin($customer_id)
{
$user = get_user_by( 'id', $customer_id );
$fullname = $order->get_billing_first_name()." ".$order->get_billing_last_name();
sendgrid_send_mail("{\"personalizations\":[{\"to\":[{\"email\":\"".$user->user_email."\",\"name\":\"".$fullname."\"}]}],\"from\":{\"email\":\"support@tellihealth.com\",\"name\":\"tellihealth\"},\"reply_to\":{\"email\":\"".$user->user_email."\",\"name\":\"".$fullname."\"},\"template_id\":\"d-d10a9fe177504e85a6c9bd297128477a\"}");
}
add_filter( 'woocommerce_login_redirect', 'my_login_redirect', 9999, 2 );