MySLP_Customer_Profile
extends SLP_Base_ReactObject
in package
MySLP_Customer_Profile class manages customer profiles and integrates various admin functionalities such as menu creation, plugin hooks, and actions specific to email settings and subscription handling.
Profile | Subscriptions | Update Card
$_REQUEST['__stripe_mid'] =
Table of Contents
Properties
- $addon : object
- $buildDir : string
- $buildURL : string
- $myslp : MySLP
- $notifications : array<string|int, mixed>
- $pageName : string
- $scriptAssetFile : string
- $scriptFile : string
- $scriptURL : string
- $slplus : SLPlus
- $pluginDir : mixed
- $pluginURL : mixed
- $scriptFilebase : mixed
- $scriptHandle : mixed
- $slug : mixed
- $uses_myslp : bool
- $uses_slplus : bool
- $wrapper_class : mixed
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- add_notification() : void
- Add Notification
- extendReactVars() : array<string|int, mixed>
- Retrieves and modifies variables used for integration with React front-end.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- page_profile() : void
- Render the My Profile page.
- render() : void
- Render admin page - default can be overriden.
- set_properties() : void
- Set our properties.
- enqueueReact() : void
- Things we normally want to do before each render
- get_vars_for_react() : array<string|int, mixed>
- Pass data from PHP to React JavaScript environment.
- initialize() : void
- Initialize the plugin by setting up hooks, filters, and actions.
- cancel_subscription() : void
- Process the "cancel subscription" button.
- change_plan() : void
- Change a subscription.
- do_when_plugins_loaded() : void
- Things that run when plugins_loaded.
- get_switch_back_url() : string
- Generates the URL to switch back to the previous user.
- get_user_profile() : array<string|int, mixed>
- Retrieves the user profile information.
- switch_to_stripe() : void
- PAYPAL: Process the "Switch To Stripe" button.
- update_card() : void
- Update the card number for Stripe users.
Properties
$addon
public
object
$addon
$buildDir read-only
public
string
$buildDir
The build directory where the React script lives.
$buildURL read-only
public
string
$buildURL
The build URL where the React script lives.
$myslp
public
MySLP
$myslp
$notifications
public
array<string|int, mixed>
$notifications
= array()
$pageName
public
string
$pageName
The page name for React, update with initialize() override.
$scriptAssetFile read-only
public
string
$scriptAssetFile
The fully qualified file name for the React script supporting an asset PHP file.
$scriptFile read-only
public
string
$scriptFile
The fully qualified file name for the React script.
$scriptURL read-only
public
string
$scriptURL
The URL for the React script.
$slplus
public
SLPlus
$slplus
$pluginDir
protected
mixed
$pluginDir
= \MYSLP_PLUGIN_DIR
$pluginURL
protected
mixed
$pluginURL
= \MYSLP_URL
$scriptFilebase
protected
mixed
$scriptFilebase
= 'profile'
$scriptHandle
protected
mixed
$scriptHandle
= 'profile'
$slug
protected
mixed
$slug
$uses_myslp
protected
bool
$uses_myslp
= \true
$uses_slplus
protected
bool
$uses_slplus
= \true
$wrapper_class
protected
mixed
$wrapper_class
= 'react-wrapper site-info-component'
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
public
__get(string $property) : SLPlus_BaseClass_Object
Parameters
- $property : string
Return values
SLPlus_BaseClass_Object__isset()
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
booladd_notification()
Add Notification
public
add_notification(string $severity, string $msg) : void
Parameters
- $severity : string
- $msg : string
extendReactVars()
Retrieves and modifies variables used for integration with React front-end.
public
extendReactVars(array<string|int, mixed> $vars) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
Return values
array<string|int, mixed> —An associative array of variables including updated MySLP-specific data.
get_instance()
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
public
static get_instance([bool $no_global = false ][, mixed $params = array() ]) : static
Parameters
- $no_global : bool = false
-
set to true to skip assigning object to SLP global as a property.
- $params : mixed = array()
-
object init params
Return values
staticpage_profile()
Render the My Profile page.
public
page_profile() : void
render()
Render admin page - default can be overriden.
public
render() : void
Provide the DOM element where the React app will render: slp-full-page-react-app
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : void
Parameters
- $options : array<string|int, mixed> = array()
enqueueReact()
Things we normally want to do before each render
protected
enqueueReact() : void
get_vars_for_react()
Pass data from PHP to React JavaScript environment.
protected
get_vars_for_react() : array<string|int, mixed>
Use this for one-time setup, things that are mostly static in PHP, but you need to send to JS.
Return values
array<string|int, mixed>initialize()
Initialize the plugin by setting up hooks, filters, and actions.
protected
final initialize() : void
Tags
cancel_subscription()
Process the "cancel subscription" button.
private
cancel_subscription() : void
Tags
change_plan()
Change a subscription.
private
change_plan() : void
Tags
do_when_plugins_loaded()
Things that run when plugins_loaded.
private
do_when_plugins_loaded() : void
Since this object is invoked when 'plugins_loaded' is called, this runs from the constructor.
Update Card $_POST [stripeToken] => tok_1T1fa0BvHKfBw2LGtMLe2eRa [stripeEmail] => costarica@storelocatorplus.com
Tags
get_switch_back_url()
Generates the URL to switch back to the previous user.
private
get_switch_back_url() : string
This method retrieves the old user and, if valid, generates a URL that allows switching back to the original user session. If the old user is not available or invalid, an empty string is returned.
Return values
string —The URL to switch back to the previous user, or an empty string if not applicable.
get_user_profile()
Retrieves the user profile information.
private
get_user_profile() : array<string|int, mixed>
Return values
array<string|int, mixed> —An associative array containing user profile details, including:
- 'first_name': The user's first name.
- 'last_name': The user's last name.
- 'email': The user's email address.
- 'member_since': The date the user registered, formatted as 'M d, Y'.
- 'is_superadmin': A boolean indicating if the user is a super administrator.
- 'edit_url': The URL for editing the user's profile.
- 'switch_back_url': The URL for switching back user context.
switch_to_stripe()
PAYPAL: Process the "Switch To Stripe" button.
private
switch_to_stripe() : void
Tags
update_card()
Update the card number for Stripe users.
private
update_card() : void
Updates user meta with revised card details.
For PayPal users (soon to be deprecated) this does nothing.