Answer the question
In order to leave comments, you need to log in
Why is the referral system not working?
Good evening, I am making a referral system on the site, but for some reason it works somehow crookedly.
Through the get request, I take the referrer nickname into the session and give it to a variable (while I was writing, I realized that this could be a mistake).
if (isset($_GET['referal'])) {
session_save_path(ROOT.SLASH.'.sid');
session_start();
$referal = $_GET['referal'];
$_SESSION['save_referal'] = $referal;
}
$ref_name = $_SESSION['save_referal'];
add_action( 'woocommerce_order_status_completed', 'referral_users' );
function referral_users($ref_name){
// Данные для линка тут есть
$link = mysqli_connect($host, $user, $password, $database)
or die("Ошибка " . mysqli_error($link));
$query = "UPDATE wp_users SET user_invited ='$ref_name'";
$s1 = mysqli_query($link, $query);
mysqli_close($link);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question