PHP Класс Give_DB_Customers, Give

С версии: 1.0
Наследование: extends Give_DB
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный Метод

Set up the Give DB Customer Class.
С версии: 1.0
public __construct ( )

add() публичный Метод

Add a customer
С версии: 1.0
public add ( array $data = [] ) : int/bool
$data array
Результат int/bool

attach_payment() публичный Метод

Attaches a payment ID to a customer
С версии: 1.0
public attach_payment ( integer $customer_id, integer $payment_id ) : boolean
$customer_id integer Customer ID.
$payment_id integer Payment ID.
Результат boolean

count() публичный Метод

Count the total number of customers in the database
С версии: 1.0
public count ( array $args = [] ) : integer
$args array
Результат integer Total number of customers.

create_table() публичный Метод

Create the table
С версии: 1.0
public create_table ( ) : void
Результат void

decrement_stats() публичный Метод

Decrements customer purchase stats
С версии: 1.0
public decrement_stats ( integer $customer_id, float $amount ) : boolean
$customer_id integer Customer ID.
$amount float Amount.
Результат boolean

delete() публичный Метод

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.
С версии: 1.0
public delete ( boolean | string | integer $_id_or_email = false ) : boolean | integer
$_id_or_email boolean | string | integer
Результат boolean | integer

exists() публичный Метод

Checks if a customer exists
С версии: 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'.
Результат boolean True is exists, false otherwise.

get_column_defaults() публичный Метод

Get default column values
С версии: 1.0
public get_column_defaults ( ) : array
Результат array Default column values.

get_columns() публичный Метод

Get columns and formats
С версии: 1.0
public get_columns ( ) : array
Результат array Columns and formats.

get_customer_by() публичный Метод

Retrieves a single customer from the database
С версии: 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.
Результат mixed Upon success, an object of the customer. Upon failure, NULL

get_customers() публичный Метод

Retrieve customers from the database
С версии: 1.0
public get_customers ( array $args = [] ) : array | object | null
$args array
Результат array | object | null Customers array or object. Null if not found.

increment_stats() публичный Метод

Increments customer purchase stats
public increment_stats ( integer $customer_id, float $amount ) : boolean
$customer_id integer Customer ID.
$amount float Amoumt.
Результат boolean

installed() публичный Метод

Check if the Customers table was ever installed
С версии: 1.4.3
public installed ( ) : boolean
Результат boolean Returns if the customers table was installed and upgrade routine run.

remove_payment() публичный Метод

Removes a payment ID from a customer
С версии: 1.0
public remove_payment ( integer $customer_id, integer $payment_id ) : boolean
$customer_id integer Customer ID.
$payment_id integer Payment ID.
Результат boolean

update_customer_email_on_user_update() публичный Метод

Updates the email address of a customer record when the email on a user is updated
С версии: 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.
Результат boolean