Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by hiep ( 5 years ago )
<?php

//send email register
function register_submit_request()
{
    if (isset($_GET['action']) && $_GET['action'] == 'account_register') {
        $action = 'account_register';
        $name = @$_GET['name'];
        $email = @$_GET['email'];

        $user = get_user_by('email', $email);

        if ($user) {
            require_once ABSPATH . WPINC . '/class-phpass.php';
            $key = wp_generate_password(20, false);
            $wpHash = new PasswordHash(8, true);
            $hashed = time() . ':' . $wpHash->HashPassword($key);

            $update = wp_update_user(
                [
                    'ID' => $user->ID,
                    'user_activation_key' => $hashed,
                ]
            );

            if ($update) {
                $body = "
                <head>
                    <link rel='preconnect' href='https://fonts.gstatic.com'>
                    <link href=fonts.googleapis.com/css2?family=Cormorant&display=swap' rel='stylesheet'>
                    <style type=\"text/css\"> @import url(fonts.googleapis.com/css2?family=Cormorant&display=swap'); p, h1, h2, h3, h4, ol, li, ul { font-family: 'Cormorant', 'sans-serif'; } </style>
                </head>
                <body>
                    <div style='text-align:center;font-family:Cormorant,sans-serif;'>
                        <div >
                            <img src='https://srv.jordanawori.com/wp-content/uploads/2021/02/JA-presents-black.png' style='border-bottom: 1px solid black; border-width: medium;'/>
                                    <h2 style='color:#A87B4F; font-weight:500'>Account Registered</h2>
                                    <h2 style='font-weight:500'>Hey, <span> " . $name . "</span></h2>
                                    <p style='font-size: 16px;'>Congratulations, you've successfully registered an account on jordanawori.com <br> 
                                To check out the special features you'll have access to <br>
                                click on the following link: </p>
                                <a style='background-color: #8e6e53;color: #fff;font-size: 17px;font-weight: 500;line-height: 40px;height: 40px;padding: 10px 20px;text-decoration: none;'
                                            href='" . home_url() . "?action=open_popup_login' >Login to your Account</a>
                                    <p style='font-size:16px;'>If you believe you've received this message in error, I apologize-<br>feel free to ignore it. If you have any
                                        concerns, please contact me at <br> [email protected]</p>
                                    <p>Thanks,</p>
                                    <h3 style='font-weight:500;'>JORDAN AWORI</h3>
                        </div>
                    </div>
                </body>
                ";

                $headers = ['Content-Type: text/html; charset=UTF-8'];
                $emailSubject = 'Account Registered';

                wp_mail($email, $emailSubject, $body, $headers);

                wp_redirect('/');
            }
        }

        die();
    }
}
add_action('parse_request', 'register_submit_request', 1);

 

Revise this Paste

Your Name: Code Language: