CRM V2

WPCrm
in package

Class de gestion des users en session avec Wordpress (ce truc immonde)

Tags
category

API

subpackage

Wordpress

author

Jérémy Munsch jeremy.munsch@ldc.fr

license

MIT https://opensource.org/licenses/MIT

link
/

Table of Contents

$api  : CrmApiV2
The user object
$user  : WPCrmUser
The user object
$sessionDestroyed  : mixed
$sessionKey  : mixed
activateUser()  : bool
Toggle the current user optin value on the current user and the crm
check()  : bool
Check if the user is Authenticated
deleteUser()  : bool
Delete current customer from the local database and the crm
forceLogin()  : WPCrmUser|null
Login user by setting user session
getNewUser()  : WPCrmUser
Generate a new user
getUser()  : WPCrmUser|null
Get the current user return null if the user is not logged in
getUserFromApi()  : WPCrmUser|false
Get the current user return api response code if an error occurs
getUserFromTable()  : array<string|int, mixed>|null
Get a customer from table
getUserFromTableByEmail()  : array<string|int, mixed>|null
Get a customer from table by an email
getUserFromTableByUuid()  : array<string|int, mixed>|null
Get a customer from table by an email
login()  : WPCrmUser|false
Try to login with CRM API return api response code if an error occurs
logout()  : void
Destroy the customer from session and therefore logout
saveUser()  : bool
Save current customer to the local database and on crm
sendArcadiaMailDefault()  : bool
send An arcadia mail with type default This methods requires to have a user in session (to be logged in)
sendArcadiaMailGame()  : bool
send An arcadia mail with type game This methods requires to have a user in session (to be logged in)
setSingleOptin()  : bool
Set the single optin status for an email on the crm
toggleUserOptin()  : bool
Toggle the current user optin value on the current user and the crm
unsetActiveUser()  : void
Remove active user to prevent WPCrm::check to return true
getRawProperty()  : mixed
Get a property
bootSessionIfNeeded()  : void
Boot the php session if needed
deleteUserFromTable()  : void
Save or update the user to the table
getCustomer()  : Customer|null
Get all customer infos
getWpDb()  : object
Get WP 'pdo instance'
initLdcApi()  : ApiV1
Get the initialized API object
loginUserWithApi()  : WPCrmUser|false
Get the current user return null if the user is not logged in
makeApiV2Call()  : mixed|false
Make a call using apiV2
query()  : object
Query in DB
saveOrUpdateUserToTable()  : void
Save or update the user to the table
setUser()  : void
Create a user stores it to the session and finally saves it to the database if it does not exists

Properties

$user

The user object

protected static WPCrmUser $user = null

$sessionDestroyed

private static mixed $sessionDestroyed = false

$sessionKey

private static mixed $sessionKey = 'LDC_CRM_USER'

Methods

activateUser()

Toggle the current user optin value on the current user and the crm

public static activateUser() : bool
Return values
bool —

true if the operation succeeded

check()

Check if the user is Authenticated

public static check() : bool
Return values
bool —

deleteUser()

Delete current customer from the local database and the crm

public static deleteUser() : bool
Return values
bool —

true if the operation succeeded

forceLogin()

Login user by setting user session

public static forceLogin() : WPCrmUser|null
Return values
WPCrmUser|null —

getUser()

Get the current user return null if the user is not logged in

public static getUser() : WPCrmUser|null
Return values
WPCrmUser|null —

getUserFromApi()

Get the current user return api response code if an error occurs

public static getUserFromApi(string $identification) : WPCrmUser|false
Parameters
$identification : string

The customer hashcode or email

Return values
WPCrmUser|false —

getUserFromTable()

Get a customer from table

public static getUserFromTable(string $hashcode) : array<string|int, mixed>|null
Parameters
$hashcode : string

The customer hashcode

Return values
array<string|int, mixed>|null —

getUserFromTableByEmail()

Get a customer from table by an email

public static getUserFromTableByEmail(string $email) : array<string|int, mixed>|null
Parameters
$email : string

The customer email

Return values
array<string|int, mixed>|null —

getUserFromTableByUuid()

Get a customer from table by an email

public static getUserFromTableByUuid(string $uuid) : array<string|int, mixed>|null
Parameters
$uuid : string

The customer transaction uuid

Return values
array<string|int, mixed>|null —

login()

Try to login with CRM API return api response code if an error occurs

public static login(string $email, string $password) : WPCrmUser|false
Parameters
$email : string

The customer email

$password : string

The customer password

Return values
WPCrmUser|false —

logout()

Destroy the customer from session and therefore logout

public static logout() : void
Return values
void —

saveUser()

Save current customer to the local database and on crm

public static saveUser() : bool
Tags
throws
ApiErrorException

with \LDC\LDCCRM\Enums\ApiError::customerExists()

Return values
bool —

true if the operation succeeded false otherwise

sendArcadiaMailDefault()

send An arcadia mail with type default This methods requires to have a user in session (to be logged in)

public static sendArcadiaMailDefault(ArcadiaMailDefault $mail) : bool
Parameters
$mail : ArcadiaMailDefault
Return values
bool —

true if succeed

sendArcadiaMailGame()

send An arcadia mail with type game This methods requires to have a user in session (to be logged in)

public static sendArcadiaMailGame(ArcadiaMailGame $mail) : bool
Parameters
$mail : ArcadiaMailGame
Return values
bool —

true if succeed

setSingleOptin()

Set the single optin status for an email on the crm

public static setSingleOptin(string $email, bool $opt_in) : bool
Parameters
$email : string
$opt_in : bool
Tags
throws
ApiErrorException

with \LDC\LDCCRM\Enums\ApiError::singleOptinCustomerExists()

Return values
bool —

true if the operation succeeded false otherwise

toggleUserOptin()

Toggle the current user optin value on the current user and the crm

public static toggleUserOptin() : bool
Tags
throws
ApiErrorException

with \LDC\LDCCRM\Enums\ApiError::singleOptinCustomerExists()

Return values
bool —

true if the operation succeeded

unsetActiveUser()

Remove active user to prevent WPCrm::check to return true

public static unsetActiveUser() : void
Return values
void —

getRawProperty()

Get a property

protected static getRawProperty(object $object, string $field) : mixed
Parameters
$object : object
$field : string
Return values
mixed —

bootSessionIfNeeded()

Boot the php session if needed

private static bootSessionIfNeeded() : void
Return values
void —

deleteUserFromTable()

Save or update the user to the table

private static deleteUserFromTable() : void
Return values
void —

getCustomer()

Get all customer infos

private static getCustomer() : Customer|null
Return values
Customer|null —

getWpDb()

Get WP 'pdo instance'

private static getWpDb() : object
Return values
object —

The $wpdb variable

initLdcApi()

Get the initialized API object

private static initLdcApi() : ApiV1
Return values
ApiV1 —

loginUserWithApi()

Get the current user return null if the user is not logged in

private static loginUserWithApi(string $email, string $password) : WPCrmUser|false
Parameters
$email : string

The customer email

$password : string

The customer password

Tags
throws
CrmException

if an error occurs on server side or on getting response

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs

Return values
WPCrmUser|false —

makeApiV2Call()

Make a call using apiV2

private static makeApiV2Call(mixed $obj, string $method[, array<string|int, mixed> $arguments = [] ]) : mixed|false
Parameters
$obj : mixed
$method : string
$arguments : array<string|int, mixed> = []
Return values
mixed|false —

query()

Query in DB

private static query(string $query[, array<string|int, mixed> $params = [] ]) : object
Parameters
$query : string

La request avec les variables en points d'interrogation

$params : array<string|int, mixed> = []

Les paramètres des la requète

Return values
object —

Containing the row columns

saveOrUpdateUserToTable()

Save or update the user to the table

private static saveOrUpdateUserToTable() : void
Return values
void —

setUser()

Create a user stores it to the session and finally saves it to the database if it does not exists

private static setUser(Customer $customer) : void
Parameters
$customer : Customer
Return values
void —

Search results