Rename customer_id to user_id to match how orders reference the user.

This commit is contained in:
Justin Shreve 2016-02-04 12:56:29 -08:00
parent 2fdb2ed2a8
commit f66a8b6478
3 changed files with 13 additions and 13 deletions

View File

@ -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;
}
/**

View File

@ -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,

View File

@ -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' ) );
}
/**