PHP Class Give_DB_Customer_Meta, Give

Inheritance: extends Give_DB
ファイルを表示 Open project: wordimpress/give

Public Methods

Method Description
__construct ( ) Get things started
add_meta ( integer $customer_id, string $meta_key = '', mixed $meta_value, boolean $unique = false ) : boolean Add meta data field to a customer.
create_table ( ) Create the table
delete_meta ( integer $customer_id, string $meta_key = '', mixed $meta_value = '' ) : boolean Remove metadata matching criteria from a customer.
get_columns ( ) Get table columns and data types
get_meta ( integer $customer_id, string $meta_key = '', boolean $single = false ) : mixed Retrieve customer meta field for a customer.
register_table ( ) Register the table with $wpdb so the metadata api can find it
update_meta ( integer $customer_id, string $meta_key = '', mixed $meta_value, mixed $prev_value = '' ) : boolean Update customer meta field based on Customer ID.

Private Methods

Method Description
sanitize_customer_id ( integer | stripe $customer_id ) : integer | boolean Given a customer ID, make sure it's a positive number, greater than zero before inserting or adding.

Method Details

__construct() public method

Get things started
Since: 1.6
public __construct ( )

add_meta() public method

For internal use only. Use Give_Customer->add_meta() for public usage.
Since: 1.6
public add_meta ( integer $customer_id, string $meta_key = '', mixed $meta_value, boolean $unique = false ) : boolean
$customer_id integer Customer ID.
$meta_key string Metadata name.
$meta_value mixed Metadata value.
$unique boolean Optional, default is false. Whether the same key should not be added.
return boolean False for failure. True for success.

create_table() public method

Create the table
Since: 1.6
public create_table ( )

delete_meta() public method

For internal use only. Use Give_Customer->delete_meta() for public usage. You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.
Since: 1.6
public delete_meta ( integer $customer_id, string $meta_key = '', mixed $meta_value = '' ) : boolean
$customer_id integer Customer ID.
$meta_key string Metadata name.
$meta_value mixed Optional. Metadata value.
return boolean False for failure. True for success.

get_columns() public method

Get table columns and data types
Since: 1.6
public get_columns ( )

get_meta() public method

For internal use only. Use Give_Customer->get_meta() for public usage.
Since: 1.6
public get_meta ( integer $customer_id, string $meta_key = '', boolean $single = false ) : mixed
$customer_id integer Customer ID.
$meta_key string The meta key to retrieve.
$single boolean Whether to return a single value.
return mixed Will be an array if $single is false. Will be value of meta data field if $single is true.

register_table() public method

Register the table with $wpdb so the metadata api can find it
Since: 1.6
public register_table ( )

update_meta() public method

For internal use only. Use Give_Customer->update_meta() for public usage. Use the $prev_value parameter to differentiate between meta fields with the same key and Customer ID. If the meta field for the customer does not exist, it will be added.
Since: 1.6
public update_meta ( integer $customer_id, string $meta_key = '', mixed $meta_value, mixed $prev_value = '' ) : boolean
$customer_id integer Customer ID.
$meta_key string Metadata key.
$meta_value mixed Metadata value.
$prev_value mixed Optional. Previous value to check before removing.
return boolean False on failure, true if success.