diff --git a/includes/abstracts/abstract-wc-payment-token.php b/includes/abstracts/abstract-wc-payment-token.php index 1a4f93f68b7..dc6300b1c27 100644 --- a/includes/abstracts/abstract-wc-payment-token.php +++ b/includes/abstracts/abstract-wc-payment-token.php @@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) { * type - string Required - WC core ships with 'cc' or 'echeck' but other values can be used for custom payment token types * token - string Required - The actual token to store * gateway_id - string Required - Identifier for the gateway this token is associated with - * customer_id - int Optional - ID for the customer this token is associated with. 0 if this token is not associated with a user + * user_id - int Optional - ID for the user this token is associated with. 0 if this token is not associated with a user * * @since 2.6.0 * @param string $id Token ID @@ -97,23 +97,23 @@ if ( ! defined( 'ABSPATH' ) ) { } /** - * Returns the customer ID associated with the token or false if this token is not associated + * Returns the user ID associated with the token or false if this token is not associated * * @since 2.6.0 - * @return mixed Customer ID if this token is associated with a user or false. + * @return mixed User ID if this token is associated with a user or false. */ - public function get_customer_id() { - return ( $this->data['customer_id'] > 0 ) ? $this->data['customer_id'] : false; + public function get_user_id() { + return ( $this->data['user_id'] > 0 ) ? $this->data['user_id'] : false; } /** - * Set the customer ID + * Set the user ID for the user associated with this order * * @since 2.6.0 - * @param int $customer_id + * @param int $user_id */ - public function set_customer_id( $customer_id ) { - $this->data['customer_id'] = $customer_id; + public function set_user_id( $user_id ) { + $this->data['user_id'] = $user_id; } /** diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index 827072c8997..c622629e039 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -491,11 +491,11 @@ CREATE TABLE {$wpdb->prefix}woocommerce_payment_tokens ( token_id bigint(20) NOT NULL auto_increment, gateway_id varchar(255) NOT NULL, token text NOT NULL, - customer_id bigint(20) NOT NULL DEFAULT '0', + user_id bigint(20) NOT NULL DEFAULT '0', type varchar(255) NOT NULL, is_default tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (token_id), - KEY customer_id (customer_id) + KEY user_id (user_id) ) $collate; CREATE TABLE {$wpdb->prefix}woocommerce_payment_tokenmeta ( meta_id bigint(20) NOT NULL auto_increment, diff --git a/includes/class-wc-payment-tokens.php b/includes/class-wc-payment-tokens.php index e61eaf89457..6b2a986c48a 100644 --- a/includes/class-wc-payment-tokens.php +++ b/includes/class-wc-payment-tokens.php @@ -147,7 +147,7 @@ class WC_Payment_Tokens { global $wpdb; $token_results = $wpdb->get_results( $wpdb->prepare( - "SELECT * FROM {$wpdb->prefix}woocommerce_payment_tokens WHERE customer_id = %d", + "SELECT * FROM {$wpdb->prefix}woocommerce_payment_tokens WHERE user_id = %d", $customer_id ) ); @@ -210,7 +210,7 @@ class WC_Payment_Tokens { * @return array Core fields */ private static function get_token_core_fields() { - return apply_filters( 'woocommerce_payment_token_core_fields', array( 'gateway_id', 'token', 'customer_id', 'type', 'is_default' ) ); + return apply_filters( 'woocommerce_payment_token_core_fields', array( 'gateway_id', 'token', 'user_id', 'type', 'is_default' ) ); } /**