GitHub Project Issue: New Manage Customers : Location Count Wrong
Follow on to this task: Sysadmin : Manage Customers UX Improvement

Reproduction

The list of customers shows locations 0 for multiple customers with locations.

  • ID: 903.901 enterprise@st…
    Locations: 0
    Actual Locations: 25

Research

New Manage Customers Module (March 2026)

React manage_customers.tsx

File: WordPress/wp-content/plugins/myslp-dashboard/src/manage_customers/manage_customers.tsx

DataGridPro (from MUIx framework) properties…

— Data set

Most likely from

    React.useEffect( () => {
        fetchData();
    }, [ fetchData ] );

Calls REST endpoint from 
const restBase: string = slpReact.url.rest + 'myslp/v2/customers';

— Column definitions

const columns = React.useMemo( () => buildColumns( homeUrl, isMonthEnd ), [ homeUrl, isMonthEnd ] );
  • function buildColumns
    • const cols: GridColDef[]…
      • field: location_count

homeUrl most likely comes from the PHP class \MySLP_Manage_Customers::extendReactVars
set to WordPress get_home_url()

REST Backend

SaaS App backend via MySLP Dashboard plugin.

— Fetching Customers
PHP method \MySLP_REST_API::register_routes defines the registered routes for WordPress.
register_rest_route( $this->myslp_namespace, ‘/customers’,…)
Calls the PHP method \MySLP_REST_API::get_customers

Location count is coming from $this->myslp->User->location_count

Root Cause Theory

This appears to be using a meta_query to fetch the user location data.
This is NOT accurate.

In some cases the MySLP_User object does not have a location_count user_meta property set.
If that is the case, it should call \SLP_Location_Manager::get_location_count for that user and store the result with

User Location Count Architecture

\MySLP_User::__get

Fetched from user_meta with the location_count property.
This is likely where the AI decided to make this a source of truth for location counts.

				case 'location_count':
				case 'mapview_count':
					$this->__get( 'user_meta' );
					$this->$property = (int) ( $this->user_meta[ $property ][0] ?? 0 );
					break;

\MySLP_REST_API::get_location_count_for_user

Currently unused anywhere in the project.
This would ensure the app switched to the user’s blog and set_database_meta() then called:
\SLP_Location_Manager::get_location_count

\SLP_Location_Manager::get_location_count

This is the original method from the legacy app code to fetch location counts.
It queries the custom SLP database that is added for every user to get the count of records.
It comes from the linchpin Store Locator Plus base plugin.

				$the_count            = $this->slplus->database->get_Value( array(
					'selectall_count',
					'where_default'
				) );


Resolution

Update \MySLP_REST_API::get_customers must first call…

// Update count and user meta storing count.
$this->get_location_count_for_user( $user->ID );

This updates the myslp->User->location_count meta by querying the SLP custom table directly.

See myslp-dashboard git repo update SHA 4f54ff1154d0cf148c603000bdcd789a669ed8cc

Leave a Reply