PHP 클래스 Give_Customer, Give

This class handles customers.
부터: 1.0
파일 보기 프로젝트 열기: wordimpress/give 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$date_created string The customer's creation date
$email string The customer's email
$id integer The customer ID
$name string The customer's name
$notes string Customer Notes
$payment_ids array The payment IDs associated with the customer
$purchase_count integer The customer's purchase count
$purchase_value integer The customer's lifetime value
$user_id integer The user ID associated with the customer

보호된 프로퍼티들

프로퍼티 타입 설명
$db Give_DB_Customers The Database Abstraction

공개 메소드들

메소드 설명
__construct ( boolean $_id_or_email = false, boolean $by_user_id = false ) Class Constructor
__get ( $key ) Magic __get function to dispatch a call to retrieve a private property.
add_meta ( string $meta_key = '', mixed $meta_value, boolean $unique = false ) : boolean Add meta data field to a customer.
add_note ( string $note = '' ) : string | boolean Add a note for the customer.
attach_payment ( integer $payment_id, boolean $update_stats = true ) : boolean Attach Payment
create ( array $data = [] ) : mixed Creates a customer
decrease_purchase_count ( integer $count = 1 ) : mixed Decrease the customer purchase count.
decrease_value ( float $value ) : mixed Decrease a customer's lifetime value.
delete_meta ( string $meta_key = '', mixed $meta_value = '' ) : boolean Remove metadata matching criteria from a customer.
get_meta ( string $meta_key = '', boolean $single = true ) : mixed Retrieve customer meta field for a customer.
get_notes ( integer $length = 20, integer $paged = 1 ) : array Get the parsed notes for a customer as an array.
get_notes_count ( ) : integer Get the total number of notes we have after parsing.
increase_purchase_count ( integer $count = 1 ) : integer Increase the purchase count of a customer.
increase_value ( float $value ) : mixed Increase the customer's lifetime value.
remove_payment ( integer $payment_id, boolean $update_stats = true ) : boolean Remove Payment
update ( array $data = [] ) : boolean Update a customer record
update_donation_value ( float $curr_amount, float $new_amount ) : mixed Decrease/Increase a customer's lifetime value.
update_meta ( string $meta_key = '', mixed $meta_value, mixed $prev_value = '' ) : boolean Update customer meta field based on customer ID.

비공개 메소드들

메소드 설명
get_raw_notes ( ) : string Get the notes column for the customer
sanitize_columns ( array $data ) : array Sanitize the data for update/create
setup_customer ( object $customer ) : boolean Setup Customer

메소드 상세

__construct() 공개 메소드

Set up the Give Customer Class.
부터: 1.0
public __construct ( boolean $_id_or_email = false, boolean $by_user_id = false )
$_id_or_email boolean
$by_user_id boolean

__get() 공개 메소드

Magic __get function to dispatch a call to retrieve a private property.
부터: 1.0
public __get ( $key )

add_meta() 공개 메소드

Add meta data field to a customer.
부터: 1.6
public add_meta ( string $meta_key = '', mixed $meta_value, boolean $unique = false ) : boolean
$meta_key string Metadata name. Default is empty.
$meta_value mixed Metadata value.
$unique boolean Optional. Whether the same key should not be added. Default is false.
리턴 boolean False for failure. True for success.

add_note() 공개 메소드

Add a note for the customer.
부터: 1.0
public add_note ( string $note = '' ) : string | boolean
$note string The note to add. Default is empty.
리턴 string | boolean The new note if added successfully, false otherwise.

attach_payment() 공개 메소드

Attach payment to the customer then triggers increasing stats.
부터: 1.0
public attach_payment ( integer $payment_id, boolean $update_stats = true ) : boolean
$payment_id integer The payment ID to attach to the customer.
$update_stats boolean For backwards compatibility, if we should increase the stats or not.
리턴 boolean If the attachment was successfuly.

create() 공개 메소드

Creates a customer
부터: 1.0
public create ( array $data = [] ) : mixed
$data array Array of attributes for a customer.
리턴 mixed False if not a valid creation, Customer ID if user is found or valid creation.

decrease_purchase_count() 공개 메소드

Decrease the customer purchase count.
부터: 1.0
public decrease_purchase_count ( integer $count = 1 ) : mixed
$count integer The amount to decrease by.
리턴 mixed If successful, the new count, otherwise false.

decrease_value() 공개 메소드

Decrease a customer's lifetime value.
부터: 1.0
public decrease_value ( float $value ) : mixed
$value float The value to decrease by.
리턴 mixed If successful, the new value, otherwise false.

delete_meta() 공개 메소드

Remove metadata matching criteria from a customer.
부터: 1.6
public delete_meta ( string $meta_key = '', mixed $meta_value = '' ) : boolean
$meta_key string Metadata name. Default is empty.
$meta_value mixed Optional. Metadata value. Default is empty.
리턴 boolean False for failure. True for success.

get_meta() 공개 메소드

Retrieve customer meta field for a customer.
부터: 1.6
public get_meta ( string $meta_key = '', boolean $single = true ) : mixed
$meta_key string The meta key to retrieve. Default is empty.
$single boolean Whether to return a single value. Default is true.
리턴 mixed Will be an array if $single is false. Will be value of meta data field if $single is true.

get_notes() 공개 메소드

Get the parsed notes for a customer as an array.
부터: 1.0
public get_notes ( integer $length = 20, integer $paged = 1 ) : array
$length integer The number of notes to get.
$paged integer What note to start at.
리턴 array The notes requested.

get_notes_count() 공개 메소드

Get the total number of notes we have after parsing.
부터: 1.0
public get_notes_count ( ) : integer
리턴 integer The number of notes for the customer.

increase_purchase_count() 공개 메소드

Increase the purchase count of a customer.
부터: 1.0
public increase_purchase_count ( integer $count = 1 ) : integer
$count integer The number to increment by.
리턴 integer The purchase count.

increase_value() 공개 메소드

Increase the customer's lifetime value.
부터: 1.0
public increase_value ( float $value ) : mixed
$value float The value to increase by.
리턴 mixed If successful, the new value, otherwise false.

remove_payment() 공개 메소드

Remove a payment from this customer, then triggers reducing stats.
부터: 1.0
public remove_payment ( integer $payment_id, boolean $update_stats = true ) : boolean
$payment_id integer The Payment ID to remove.
$update_stats boolean For backwards compatibility, if we should increase the stats or not.
리턴 boolean If the removal was successful.

update() 공개 메소드

Update a customer record
부터: 1.0
public update ( array $data = [] ) : boolean
$data array Array of data attributes for a customer (checked via whitelist).
리턴 boolean If the update was successful or not.

update_donation_value() 공개 메소드

This function will update donation stat on basis of current amount and new amount donation difference. Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
부터: 1.0
public update_donation_value ( float $curr_amount, float $new_amount ) : mixed
$curr_amount float Current Donation amount.
$new_amount float New (changed) Donation amount.
리턴 mixed If successful, the new donation stat value, otherwise false.

update_meta() 공개 메소드

Update customer meta field based on customer ID.
부터: 1.6
public update_meta ( string $meta_key = '', mixed $meta_value, mixed $prev_value = '' ) : boolean
$meta_key string Metadata key. Default is empty.
$meta_value mixed Metadata value.
$prev_value mixed Optional. Previous value to check before removing. Default is empty.
리턴 boolean False on failure, true if success.

프로퍼티 상세

$date_created 공개적으로 프로퍼티

The customer's creation date
부터: 1.0
public string $date_created
리턴 string

$db 보호되어 있는 프로퍼티

The Database Abstraction
부터: 1.0
protected Give_DB_Customers $db
리턴 Give_DB_Customers

$email 공개적으로 프로퍼티

The customer's email
부터: 1.0
public string $email
리턴 string

$id 공개적으로 프로퍼티

The customer ID
부터: 1.0
public int $id
리턴 integer

$name 공개적으로 프로퍼티

The customer's name
부터: 1.0
public string $name
리턴 string

$notes 공개적으로 프로퍼티

Customer Notes
부터: 1.0
public string $notes
리턴 string

$payment_ids 공개적으로 프로퍼티

The payment IDs associated with the customer
부터: 1.0
public array $payment_ids
리턴 array

$purchase_count 공개적으로 프로퍼티

The customer's purchase count
부터: 1.0
public int $purchase_count
리턴 integer

$purchase_value 공개적으로 프로퍼티

The customer's lifetime value
부터: 1.0
public int $purchase_value
리턴 integer

$user_id 공개적으로 프로퍼티

The user ID associated with the customer
부터: 1.0
public int $user_id
리턴 integer