wc_maybe_store_user_agent

Store user agents.

Description

wc_maybe_store_user_agent( $user_login, $user ); 

Used for tracker.

Parameters (2)

0. $user_login
The user login.
1. $user
The user.

Usage

  1. if ( !function_exists( 'wc_maybe_store_user_agent' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4. // The user login. 
  5. $user_login = null; 
  6.  
  7. // The user. 
  8. $user = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_maybe_store_user_agent($user_login, $user); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-core-functions.php  
  1. function wc_maybe_store_user_agent( $user_login, $user ) { 
  2. if ( 'yes' === get_option( 'woocommerce_allow_tracking', 'no' ) && user_can( $user, 'manage_woocommerce' ) ) { 
  3. $admin_user_agents = array_filter( (array) get_option( 'woocommerce_tracker_ua', array() ) ); 
  4. $admin_user_agents[] = wc_get_user_agent(); 
  5. update_option( 'woocommerce_tracker_ua', array_unique( $admin_user_agents ) );