WPCrmUser
in package
implements
JsonSerializable
Class de gestion des users en session avec Wordpress (ce truc immonde)
Tags
Interfaces, Classes and Traits
- JsonSerializable
Table of Contents
- $address : string
- $address2 : string
- $birth_date : string
- $city : string
- $country : Country
- $email : string
- $firstname : string
- $hashcode : string
- $last_connection : string
- $lastname : string
- $opt_in : bool
- $password : string
- $phone : string
- $postcode : string
- $status : bool
- $uuidToken : string
- $info : Customer
- The CRM customer info (the api response)
- $pemail : string
- The CRM customer email
- $phashcode : string
- The CRM hashcode (UUID)
- $uuidToken : string
- The CRM customer temp uuidToken to validate transactions
- __construct() : mixed
- WPCrmUser construct
- __get() : bool|string|Country|null
- Generic accessor
- __set() : void
- Generic mutator
- activate() : bool
- Activate the account in the crm
- delete() : bool
- Delete current customer to the local database and on crm
- jsonSerialize() : array<string|int, mixed>
- Serialize this object to an array
- parseFromJson() : WPCrmUser
- Generate a user from session data
- save() : bool
- Save current customer to the local database and on crm
- setInfo() : void
- Set the customer info with api response
- toggleOptin() : bool
- Toggle the current user optin value on the current user and the crm
Properties
$address
public
string
$address
The account address (street number, name, build, flat number)
$address2
public
string
$address2
— The account phone (address complement)
$birth_date
public
string
$birth_date
— The account birth date 'yyyy-mm-dd'
$city
public
string
$city
— The account city name
$country
public
Country
$country
— The account country residence
public
string
$email
— Must be a rfc valid email on a valid domain name
$firstname
public
string
$firstname
— The account first name
$hashcode
public
string
$hashcode
— The crm hashcode this is a readonly field
$last_connection
public
string
$last_connection
the last time user was connected 'yyyy-mm-dd HH:ii:ss'
$lastname
public
string
$lastname
— The account last name
$opt_in
public
bool
$opt_in
— true if the account is opt in
$password
public
string
$password
Required only on create, must have upper and lowers chars, at least 1 number, at leat 1 upper char, at least 1 lower char and at leat 1 special char
$phone
public
string
$phone
— The account phone
$postcode
public
string
$postcode
— The account city postcode
$status
public
bool
$status
— true if the account is activated
$uuidToken
public
string
$uuidToken
— A local transaction token for this user
$info
The CRM customer info (the api response)
protected
Customer
$info
= null
$pemail
The CRM customer email
protected
string
$pemail
= null
$phashcode
The CRM hashcode (UUID)
protected
string
$phashcode
= null
$uuidToken
The CRM customer temp uuidToken to validate transactions
protected
string
$uuidToken
= null
UUID
Methods
__construct()
WPCrmUser construct
public
__construct([string $hashcode = null ][, string $email = null ]) : mixed
Parameters
- $hashcode : string = null
-
The customer hashcode (UUID).
- $email : string = null
-
The customer email.
Return values
mixed —__get()
Generic accessor
public
__get(string $prop) : bool|string|Country|null
Parameters
- $prop : string
-
The prop to get.
Return values
bool|string|Country|null —__set()
Generic mutator
public
__set(string $prop, mixed $value) : void
Parameters
- $prop : string
-
The property to assign.
- $value : mixed
-
The value to set.
Return values
void —activate()
Activate the account in the crm
public
activate() : bool
Tags
Return values
bool —true if succeeded
delete()
Delete current customer to the local database and on crm
public
delete() : bool
Tags
Return values
bool —true if the operation succeeded false otherwise
jsonSerialize()
Serialize this object to an array
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —parseFromJson()
Generate a user from session data
public
static parseFromJson(string $string) : WPCrmUser
Parameters
- $string : string
-
The json data stored in session.
Tags
Return values
WPCrmUser —save()
Save current customer to the local database and on crm
public
save() : bool
Tags
Return values
bool —true if the operation succeeded false otherwise
setInfo()
Set the customer info with api response
public
setInfo(Customer $customer) : void
Parameters
- $customer : Customer
-
The Api object reponse (user).
Return values
void —toggleOptin()
Toggle the current user optin value on the current user and the crm
public
toggleOptin() : bool
Tags
Return values
bool —true if the operation succeeded