Ecommerce Shopify WordPress Discussion

Send email to referrals in wordpress

i have been having serious difficulties trying to send email from WordPress using custom code. Details: I am using Ultimate Member plugin and Wp Referral Code Plugin on my website to effect a real estate affiliate program. I want it that when a use use A signs up with user B's referral link, user B should get an email of the following details about user A: Full Name, Email and mobile number. i have tried all i can even using several the Wp Referral Code plugin support articles `i am abit new to php for wordpress so i really need help. Finally, i have a registration form from Ultimate Member Plugin that i use for users signups. the registration link looks like this, 'wkit' here represents a referral code form a user. I want to be able to use the code to parse the full name of the user whose referral link is being used into a simple text field on the registration form (field will be locked) `here is what i have tried for the email: function send_referral_email_with_details($new_user_id, $referrer_user_id) { // Get the referrer's details $referrer_data = get_userdata($referrer_user_id); $referrer_name = $referrer_data->full_name; $referrer_email = $referrer_data->user_email; // Get the new user's details $new_user_data = get_userdata($new_user_id); $new_user_name = $new_user_data->full_name; $new_user_email = $new_user_data->user_email; $new_user_mobile = $new_user_data->mobile_number; // Construct the email $subject = 'New Referral Registration Notice on SD Realtors Network!'; $body = '<html> <head> <!-- Your styles here --> </head> <body> <div class="container"> <h1>New Referral Registration Notice on SD Realtors Network!</h1> <p>Hello, ' . $referrer_name . '!<br>Someone just Registered using your Referral link.</p> <h3>Details of New User</h3> <p>Full Name: ' . $new_user_name . '</p> <p>Email: ' . $new_user_email . '</p> <p>Mobile Number: ' . $new_user_mobile . '</p> <p>If you have any problems, please contact us at <a sdrealtorsnetwork1@gmail.com</a></p> </div> </body> </html>'; $headers = array('Content-Type: text/html; charset=UTF-8'); // Send the email wp_mail($referrer_email, $subject, $body, $headers); } here is what i have tried for the Registration form: add_filter( 'um_pre_register_form', function($form) { // Check for referral code in URL parameter if (isset($_GET['ref'])) { $ref_code = sanitize_text_field($_GET['ref']); // Use plugin function to get upline user ID based on referral code $upline_user_id = wp_referral_code_get_user_id_by_code($ref_code); // If upline user found, retrieve their full name if ($upline_user_id) { $upline_user = get_user_by('id', $upline_user_id); $upline_full_name = $upline_user->display_name; // Add new field to registration form $form->add_field('upline_name', array( ' type' => 'label', 'label' => __('Referred by:', 'your-textdomain'), 'value' => $upline_full_name, 'readonly' => true, )); } } return $form; }); function shalihor_get_referrer_info($atts) { $user_id = get_current_user_id(); $referrer_id = get_user_meta($user_id, 'wrc_referrer_id', true); if ($referrer_id) { $referrer_user = get_user_by('id', $referrer_id); $data = array( 'full_name' => $referrer_user->display_name, // Retrieve other desired referrer data here ); return shortcode_atts($atts, $data); } else { return ''; } } add_shortcode('shalihor_referrer_info', 'shalihor_get_referrer_info');`` both did not work,sad. i spent several nights doing this.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.