A user canceled their account. The website immediate showed the SLP maps as expired instead of checking the renewal/expiration date.
Reproduction
E2E Steps
- Login as professional@storelocatorplus.com
- Make sure the account is active
- Go to My Profile by clicking “My Profile” in the admin sidebar
xpath=//*[@id=”toplevel_page_myslp_profile”] - Affirm there is a Cancel Subscription button on the page
xpath=//*[@data-cy=”cancel-subscription-button”]
- Go to My Profile by clicking “My Profile” in the admin sidebar
- Click the Cancel Subscription button
- Go to Generate Embed by clicking “Generate Embed” in the admin sidebar
xpath=//*[@id=”toplevel_page_admin-page-myslp-dashboard-tab-deployment”]
If the account still has time left on the subscription.
The map display area on the Generate Embed page should not show the text “This Store Locator Plus® account has expired.”
The embedded map output (Generate Embed) if the SLP SaaS account is expired:
<div id="MySLP-map-wrap"><div class="map-messages">This Store Locator Plus® account has expired.</div><div class="map-container"></div></div>
The Fix
Make \MySLP_REST_API::check_activation method account for day left on a canceled subscription.
$accountActive = ( 'active' === $myslpUser->account_status );
if ( ! $accountActive ) {
$daysleft = floor( ( ( ( strtotime( $myslpUser->expiration_date ) - strtotime( "today" ) ) / 24 ) / 60 ) / 60 );
if ($daysleft > 0){
$accountActive = true;
}
}
// Account active
if ( $accountActive ) {
$this->user = $user->ID;
$this->set_options();
$this->status[ $API_key ] = true;
} else {
$this->status[ $API_key ] = false;
}
Research
Find “account has expired”
- Email settings for the app (email receipts, etc.)
WordPress/wp-content/plugins/myslp-dashboard/include/template/tab-expiration.php - Email processing for accounts
WordPress/wp-content/plugins/myslp-dashboard/include/MySLP_Email_Settings.php
\MySLP_Email_Settings::send_expired_action - SLP SaaS REST API endpoint
WordPress/wp-content/plugins/myslp-dashboard/include/MySLP_REST_API.php
Most Likely Culprit
\MySLP_REST_API::get_map_options
which calls \MySLP_REST_API::check_activation
Confirmed.
if ( 'active' !== $this->myslp->User->account_status ) {
$this->status[ $API_key ] = false;
// $this->myslp->User->account_status = 'expired'
MySLP_User::$account_status
This is stored in the user meta under the key ‘account_status’.
myslp->User is a \MySLP_User object.
\MySLP_User::$account_status is a private property accessed via special methods and setters/getters.
\MySLP_User::__get
case 'account_status':
$this->__get( 'user_meta' );
$this->$property = $this->user_meta[ $property ][0] ?? '';
The My Profile component pulls subscription data here: \Customer_Profile_Subscription::get_subscription_data
which fetches \MySLP_User::get_current_subscription
In React (JavaScript): slpReact.mySLP.subscription comes from those…
(JS) slpReact.mySLP.subscription = (PHP) \Customer_Profile_Subscription::get_subscription_data()
The Profile page looks at subscription.days_left, subscription.is_cancelled, and subscription.expiration_date to determine the complete state. It does NOT only use the user_meta.account_status value.
\MySLP_REST_API::check_activation needs to do the same.