Store Locator Plus® SaaS WordPress Menus

This is a technical document about the internal structure of the Store Locator Plus® menu configuration.

MySLP SaaS WordPress Menus

How the menu descriptions are laid out:

  • position label : menu_slug [if user_can(<capability>)]
    • label : submenu_slug [if user_can(<capability>)]

Customer Menus

  • 30 MySLP : myslp-dashboard if user_can ( ‘manage_options’ )
  • 1000.1 My Profile : myslp_profile if user_can ( ‘manage_options’ )
  • 1000.2 Log Out : ../wp-login.php?action=logout if user_can( ‘manage_options’ )
  • 1000.3 Contact Us : myslp_contact_form if user_can( ‘manage_options’ )

WordPress Menu Functions

add_menu_page()

For adding “top level” menus.

add_menu_page( 
string $page_title, 
string $menu_title, 
string $capability, 
string $menu_slug, 
callable $callback = ”, 
string $icon_url = ”, 
int|float $position = null 
): string

$menu_slug is the “key” that identifies this menu, must be unique within the WP installation.

add_submenu_page()

For attaching submenus to the “top level” menus.

add_submenu_page( 
string $parent_slug, 
string $page_title, 
string $menu_title, 
string $capability, 
string $menu_slug, 
callable $callback = ”, 
int|float $position = null 
): string|false

The first parameter should match a parent slug (the 4th parameter) from the add_menu() calls.

WordPress Roles & Capabilities

WordPress roles, oddly enough, are stored for each user in the wp_user_meta table in the meta_key ‘wp_capabilities’.

Relationship definition:

  • role slug (Name)
    • capability slug – enabled by default on WP install or granted by Store Locator Plus®

The roles and capabilities within the Store Locator Plus® system include:

  • super (Super Admin)
    • manage_options
  • administrator (Administrator)
    • manage_options
    • manage_slp, granted by main SLP plugin
    • manage_slp_admin, granted by main SLP plugin
    • manage_slp_user, granted by main SLP plugin
  • subscriber (Subscriber)
    • read
  • myslp_customer (MYSLP Customer)
    • myslp_customer
    • read

WordPress Multisite Capabilities

For users on multisite there are two entries in the wp_usermeta table.

The meta_key wp_capabilities on MySLP this value has been set at a single role – ‘subscriber’.
This defines the capabilities of the user on the main site on the platform, this is the master site and should only be open to system administrators.

The meta_key wp_<site_id>_capabilities on MySSLP this value has been set to the role – ‘administrator’.
This sets the capabilities for the subsite, where each user should be the administrator for their own site.

Image by Kevin Seibel from Pixabay