• Resolved ljchique

    (@ljchique)


    Hi shalior, thanks for this incredible tool.

    I am interested in mailing the referral link and code to users.

    Could you tell me how to do it?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author shalior

    (@shalior)

    Hi, you’re welcome. happy to help.

    there are some plugins to send email to users. check out Email Users and WP Email Users. you can use [wp-referral-code var=”ref_link”] shortcode to display refer link in email content. and [wp-referral-code var=”ref_code”] for refer code.

    here is a simple snippet. it emails refer link to user on registration. you should modify subject and body(html) variables.

    add_action('user_register', function ($user_id) {
        /** @var WP_User $user */
        $user = WP_user::get_data_by('id', $user_id);
        $ref_code = new WP_Refer_Code($user_id);
        $to = $user->user_email;
        $subject = 'The Email subject';
        $body = 'Hey '.$user->first_name.'. Your refer code is: <a href="'
            .$ref_code->get_ref_link().'" target="_blank">'.$ref_code->get_ref_link()."</a>";
        $headers = array('Content-Type: text/html; charset=UTF-8');
        wp_mail($to, $subject, $body, $headers);
    });
    Plugin Author shalior

    (@shalior)

    resolved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Send Referral link and code via Email’ is closed to new replies.