تابع ووکامرسی wc_set_customer_auth_cookie ثبت کوکی ورود برای کاربر داده شده

تابع ووکامرسی wc_set_customer_auth_cookie – ثبت کوکی ورود برای کاربر داده شده
Syntax – سینتکس
wc_set_customer_auth_cookie( (int) $customer_id );
Parameters – پارامتر ها (1)
- 1- $customer_id (int)
Usage – نحوه استفاده
if ( !function_exists( 'wc_set_customer_auth_cookie' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-user-functions.php';
}
// The customer id.
$customer_id = -1;
// NOTICE! Understand what this does before running.
$result = wc_set_customer_auth_cookie($customer_id);
Defined – محل تعریف
/includes/wc-user-functions.php
function wc_set_customer_auth_cookie( $customer_id ) {
global $current_user;
$current_user = get_user_by( 'id', $customer_id );
wp_set_auth_cookie( $customer_id, true );
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر