Property | Type | Description | |
---|---|---|---|
$date_created | string | The customer's creation date | |
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 |
Property | Type | Description | |
---|---|---|---|
$db | Give_DB_Customers | The Database Abstraction |
Method | Description | |
---|---|---|
__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. |
Method | Description | |
---|---|---|
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 |
public __construct ( boolean $_id_or_email = false, boolean $by_user_id = false ) | ||
$_id_or_email | boolean | |
$by_user_id | boolean |
public __get ( $key ) |
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. |
return | boolean | False for failure. True for success. |
public decrease_purchase_count ( integer $count = 1 ) : mixed | ||
$count | integer | The amount to decrease by. |
return | mixed | If successful, the new count, otherwise false. |
public decrease_value ( float $value ) : mixed | ||
$value | float | The value to decrease by. |
return | mixed | If successful, the new value, otherwise false. |
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. |
return | mixed | Will be an array if $single is false. Will be value of meta data field if $single is true. |
public get_notes_count ( ) : integer | ||
return | integer | The number of notes for the customer. |
public increase_purchase_count ( integer $count = 1 ) : integer | ||
$count | integer | The number to increment by. |
return | integer | The purchase count. |
public increase_value ( float $value ) : mixed | ||
$value | float | The value to increase by. |
return | mixed | If successful, the new value, otherwise false. |
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. |
return | boolean | False on failure, true if success. |
public string $date_created | ||
return | string |
protected Give_DB_Customers $db | ||
return | Give_DB_Customers |
public array $payment_ids | ||
return | array |
public int $purchase_count | ||
return | integer |
public int $purchase_value | ||
return | integer |
public int $user_id | ||
return | integer |