Could Not Load User 310

In the debug logs , any time super admin would list customers it would throw an error from

\MySLP_User::load() saying could not load blog for user #310.

Turns out this was caused by user 310 (cici) not having an associated site ID as it is a super admin account. Set the fallback to point to the main site (Site #1) when super admin does not have a site id.

Fixed in MySLP Dashboard 2503.04.01 and MySLP Architect 2503.04.01.

\SLP_BaseClass_Admin::enqueue_admin_javascript()

	/**
	 * Enqueues Admin JavaScript for include/admin.js and js/admin.js and js/admin-<tabname>-tab.js (minified if present)
	 *
	 * @used-by \SLP_BaseClass_Admin::add_hooks_and_filters     for WP Hook: admin_enqueue_scripts [10]
	 *
	 * @see https://docs.storelocatorplus.com/development/2022/07/13/debugging-add-locations-w-power-uncaught-syntaxerror-redeclaration-of-const-wp_data/
	 *
	 * @param string $hook
	 */

Generic admin.js script loading

Admin Tab Specific script loading

This loads up javascript files , if they exist, for specific tabs such as “info” or “experience”.

The tab name is simplified by stripping SLP_ADMIN_PAGEPRE . ‘slp_’ from the hook name for the page.

SLP_ADMIN_PAGEPRE is set in the main Store Locator Plus plugin loader.php file as

defined( 'SLP_ADMIN_PAGEPRE' ) || define( 'SLP_ADMIN_PAGEPRE', 'store-locator-plus_page_' );

As of 2501.06.01 this will also check and strip “toplevel_page_slp_” from the hook name to decide it is should enqueue a tab-specific script.

Payment Method undefined In SysAdmin View Profile

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 275

Reproduction

  • Login as SA
  • List Customers
  • Choose a customer , highlight the row and click “view profile” under the menu.

When the page renders the debug.log entry will show the message above.

Resolution

Stop Gap

A stop-gap measure is in place to default to text “stripe”, but we need to find out why the myslp->User object does not have a payment method set.

$payment_method = $myslp->User->payment_method ?? 'stripe';

Various PHP 8 Errors

Related To Blog ID Not Set

  • [08-Nov-2024 20:28:43 UTC] PHP Warning: Undefined variable $user_blog in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 387
  • [08-Nov-2024 20:28:43 UTC] PHP Warning: Attempt to read property “blog_id” on null in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 387
  • [08-Nov-2024 20:28:43 UTC] PHP Warning: Undefined variable $user_blog in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 391
  • [08-Nov-2024 20:28:43 UTC] PHP Warning: Attempt to read property “path” on null in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 391
  • [08-Nov-2024 20:28:43 UTC] PHP Warning: Undefined variable $user_blog in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 393
  • [08-Nov-2024 20:28:43 UTC] PHP Warning: Attempt to read property “path” on null in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 393
  • [08-Nov-2024 20:41:38 UTC] PHP Warning: Attempt to read property “path” on int in /var/www/html/wp-content/plugins/myslp-customer-maintenance/include/MySLP_SysAdmin_View_Profile.php on line 409

Invalid submenu call

  • [08-Nov-2024 20:28:43 UTC] PHP Deprecated: strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/wp-admin/admin-header.php on line 36

Reproduction

  • Login as SA
  • Customers | All Users
  • Search CiCi
  • Hover and click profile
  • errors are in the debug.log

Resolution

Related To Blog ID Not Set

These errors are all related to an issue in the MySLP Customer Maintenance plugin where the $user_blog var was not set to a proper WP_Site object when the user was an SA.

Added a line to fetch WP_Site based on the $myslp->User->blog_id in those cases.

Invalid Submenu Call

This strip_tags() error is coming from WP core admin functions. Turns out the admin-header rendering expected a call to add_submenu_page to actually name a menu in the first param, not pass ” as a string. Apparently you need to attach all submenus to a parent menu of some kind.


Attached the View Profile admin page to the ‘users.php’ (Customers) menu as a submenu.