3.2
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['kr3register'])) {
$username = sanitize_user($_POST['reg_username']);
$email = sanitize_email($_POST['reg_email']);
$password = $_POST['reg_password'];
$confirm = $_POST['reg_confirm'];
if ($password !== $confirm) { $error = 'পাসওয়ার্ড মেলেনি।'; }
elseif (username_exists($username)) { $error = 'ইউজারনেম ইতিমধ্যে নেওয়া।'; }
elseif (email_exists($email)) { $error = 'ইমেইল ইতিমধ্যে ব্যবহৃত।'; }
else {
$user_id = wp_create_user($username, $password, $email);
if (is_wp_error($user_id)) { $error = $user_id->get_error_message(); }
else {
// স্বয়ংক্রিয় লগইন
wp_set_current_user($user_id);
wp_set_auth_cookie($user_id);
wp_redirect(home_url('/dashboard'));
exit;
}
}
}
0 Comments
Post a Comment