wc_meta_update_last_update_time بروزرسانی فیلد meta کاربر و زمان بروزرسانی

wc_meta_update_last_update_time بروزرسانی فیلد meta کاربر و زمان بروزرسانی

تابع ووکامرسی wc_meta_update_last_update_time – بروزرسانی فیلد meta کاربر و زمان آخرین بروزرسانی

Syntax – سینتکس

wc_meta_update_last_update_time( (int) $meta_id, (int) $user_id, (string) $meta_key, (string) $_meta_value ); 

Parameters – پارامتر ها (4)

  • 1- $meta_id (int)
  • 2- $user_id (int)
  • 3- $meta_key (string)
  • 4- $meta_value (string)

Usage – نحوه استفاده

if ( !function_exists( 'wc_meta_update_last_update_time' ) ) { 
    require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-user-functions.php'; 
} 
  
// ID of the meta object that was changed. 
$meta_id = -1; 
  
// The user that was updated. 
$user_id = -1; 
  
// Name of the meta key that was changed. 
$meta_key = ''; 
  
// Value of the meta that was changed. 
$meta_value = ''; 
  
// NOTICE! Understand what this does before running. 
$result = wc_meta_update_last_update_time($meta_id, $user_id, $meta_key, $meta_value); 
    

Defined – محل تعریف

/includes/wc-user-functions.php

function wc_meta_update_last_update_time( $meta_id, $user_id, $meta_key, $_meta_value ) { 
    $keys_to_track = apply_filters( 'woocommerce_user_last_update_fields', array( 'first_name', 'last_name' ) ); 
    $update_time = false; 
    if ( in_array( $meta_key, $keys_to_track ) ) { 
        $update_time = true; 
    } 
    if ( 'billing_' === substr( $meta_key, 0, 8 ) ) { 
        $update_time = true; 
    } 
    if ( 'shipping_' === substr( $meta_key, 0, 9 ) ) { 
        $update_time = true; 
    } 
 
    if ( $update_time ) { 
        wc_set_user_last_update_time( $user_id ); 
    } 
} 

versions – نسخه ها

از نسخه : 2.6.0

نسخه فعلی : 3.0.6

دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2

ارسال نظر

جهت استفاده از کد حتما از تگ pre استفاده نمایید .

contact us