PHP Class Give_DB_Customers, Give

Since: 1.0
Inheritance: extends Give_DB
Afficher le fichier Open project: wordimpress/give Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( ) Class Constructor
add ( array $data = [] ) : int/bool Add a customer
attach_payment ( integer $customer_id, integer $payment_id ) : boolean Attaches a payment ID to a customer
count ( array $args = [] ) : integer Count the total number of customers in the database
create_table ( ) : void Create the table
decrement_stats ( integer $customer_id, float $amount ) : boolean Decrements customer purchase stats
delete ( boolean | string | integer $_id_or_email = false ) : boolean | integer Delete a customer
exists ( string $value = '', string $field = 'email' ) : boolean Checks if a customer exists
get_column_defaults ( ) : array Get default column values
get_columns ( ) : array Get columns and formats
get_customer_by ( string $field = 'id', mixed $value ) : mixed Retrieves a single customer from the database
get_customers ( array $args = [] ) : array | object | null Retrieve customers from the database
increment_stats ( integer $customer_id, float $amount ) : boolean Increments customer purchase stats
installed ( ) : boolean Check if the Customers table was ever installed
remove_payment ( integer $customer_id, integer $payment_id ) : boolean Removes a payment ID from a customer
update_customer_email_on_user_update ( integer $user_id, WP_User $old_user_data ) : boolean Updates the email address of a customer record when the email on a user is updated

Method Details

__construct() public méthode

Set up the Give DB Customer Class.
Since: 1.0
public __construct ( )

add() public méthode

Add a customer
Since: 1.0
public add ( array $data = [] ) : int/bool
$data array
Résultat int/bool

attach_payment() public méthode

Attaches a payment ID to a customer
Since: 1.0
public attach_payment ( integer $customer_id, integer $payment_id ) : boolean
$customer_id integer Customer ID.
$payment_id integer Payment ID.
Résultat boolean

count() public méthode

Count the total number of customers in the database
Since: 1.0
public count ( array $args = [] ) : integer
$args array
Résultat integer Total number of customers.

create_table() public méthode

Create the table
Since: 1.0
public create_table ( ) : void
Résultat void

decrement_stats() public méthode

Decrements customer purchase stats
Since: 1.0
public decrement_stats ( integer $customer_id, float $amount ) : boolean
$customer_id integer Customer ID.
$amount float Amount.
Résultat boolean

delete() public méthode

NOTE: This should not be called directly as it does not make necessary changes to the payment meta and logs. Use give_customer_delete() instead.
Since: 1.0
public delete ( boolean | string | integer $_id_or_email = false ) : boolean | integer
$_id_or_email boolean | string | integer
Résultat boolean | integer

exists() public méthode

Checks if a customer exists
Since: 1.0
public exists ( string $value = '', string $field = 'email' ) : boolean
$value string The value to search for. Default is empty.
$field string The Customer ID or email to search in. Default is 'email'.
Résultat boolean True is exists, false otherwise.

get_column_defaults() public méthode

Get default column values
Since: 1.0
public get_column_defaults ( ) : array
Résultat array Default column values.

get_columns() public méthode

Get columns and formats
Since: 1.0
public get_columns ( ) : array
Résultat array Columns and formats.

get_customer_by() public méthode

Retrieves a single customer from the database
Since: 1.0
public get_customer_by ( string $field = 'id', mixed $value ) : mixed
$field string ID or email. Default is 'id'.
$value mixed The Customer ID or email to search. Default is 0.
Résultat mixed Upon success, an object of the customer. Upon failure, NULL

get_customers() public méthode

Retrieve customers from the database
Since: 1.0
public get_customers ( array $args = [] ) : array | object | null
$args array
Résultat array | object | null Customers array or object. Null if not found.

increment_stats() public méthode

Increments customer purchase stats
public increment_stats ( integer $customer_id, float $amount ) : boolean
$customer_id integer Customer ID.
$amount float Amoumt.
Résultat boolean

installed() public méthode

Check if the Customers table was ever installed
Since: 1.4.3
public installed ( ) : boolean
Résultat boolean Returns if the customers table was installed and upgrade routine run.

remove_payment() public méthode

Removes a payment ID from a customer
Since: 1.0
public remove_payment ( integer $customer_id, integer $payment_id ) : boolean
$customer_id integer Customer ID.
$payment_id integer Payment ID.
Résultat boolean

update_customer_email_on_user_update() public méthode

Updates the email address of a customer record when the email on a user is updated
Since: 1.4.3
public update_customer_email_on_user_update ( integer $user_id, WP_User $old_user_data ) : boolean
$user_id integer User ID.
$old_user_data WP_User User data.
Résultat boolean