Please note that caution has to be used when manipulating the Maps Marker Pro database directly via the API to avoid data loss. All calls are immediate and cannot be undone.
Please also be aware that our support does not cover help with custom development and can only answer questions about the API itself.
To use the DB API, we first have to instantiate the class:
$db = new MMP\DB();
Maps return objects with the following properties:
id: ID name: Name settings: An object containing the map settings (JSON encoded) filters: An object containing the map filters (JSON encoded) created_by_id: The ID of the user who created the map created_on: The date and time when the map was created updated_by_id: The ID of the user who last updated the map updated_on: The date and time when the map was last updated markers: The number of markers that are assigned to this map (if requested)
Markers return objects with the following properties:
id: ID name: Name address: Address lat: Latitude lng: Longitude zoom: Zoom icon: Icon filename popup: Popup contents link: URL to be opened instead of showing a popup created_by_id: The ID of the user who created the marker created_on: The date and time when the marker was created updated_by_id: The ID of the user who last updated the marker updated_on: The date and time when the marker was last updated maps: Array of map IDs that the marker is assigned to
Get the map with ID 1, change the name, width and height and save the changes
$map = $db->get_map(1); $map->name = 'Car dealerships'; $settings = json_decode($map->settings); $settings->width = 640; $settings->height = 480; $map->settings = json_encode($settings); $db->update_map($map, 1);
Get the marker with ID 1, change the name, icon and popup and save the changes
$marker = $db->get_marker(1); $marker->name = 'Dealership 1'; $marker->icon = 'car.png'; $marker->popup = '<a href="https://example.com">Dealership 1 website</a>'; $db->update_marker($marker, 1);
Creates the database tables
This method has no parameters
No value is returned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Deletes the database tables
This method has no parameters
No value is returned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Resets the database tables
This method has no parameters
No value is returned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the total number of maps
Optionally accepts a list of filters
(int) Total number of maps
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the map for the given ID
(object|null) Map object or null if no result is found
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the maps for the given IDs
(array) List of map objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns all maps
Optionally accepts a list of filters
(array) List of map objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns all posts that use a shortcode for the given map ID
(array) List of posts
| Version | Description |
|---|---|
| 4.0 | Introduced |
Adds a map
(int|bool) Map ID or false if the map could not be added
| Version | Description |
|---|---|
| 4.0 | Introduced |
Adds multiple maps
(int|bool) Number of affected rows or false if the maps could not be added
| Version | Description |
|---|---|
| 4.0 | Introduced |
Updates a map
(int|bool) Number of affected rows or false if the map could not be updated
| Version | Description |
|---|---|
| 4.0 | Introduced |
Updates multiple maps
(int) Number of affected rows
| Version | Description |
|---|---|
| 4.0 | Introduced |
Deletes a map and its relationships
(int|bool) Number of affected rows or false if the map could not be deleted
| Version | Description |
|---|---|
| 4.0 | Introduced |
Deletes multiple maps and their relationships
(int|bool) Number of affected rows or false if the maps could not be deleted
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the total number of markers
Optionally accepts a list of filters
(int) Total number of markers
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the total number of markers for the given map ID
(int) Total number of markers for the given map ID
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the marker for the given ID
(object|null) Marker object or null if no result is found
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the markers for the given IDs
(array) List of marker objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns all markers
Optionally accepts a list of filters
(array) List of marker objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the markers for the given map ID
(array) List of marker objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the markers for the given map IDs
(array) List of marker objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Adds a marker
(int|bool) Marker ID or false if the marker could not be added
| Version | Description |
|---|---|
| 4.0 | Introduced |
Adds multiple markers
(int|bool) Number of affected rows or false if the markers could not be added
| Version | Description |
|---|---|
| 4.0 | Introduced |
Updates a marker
(int|bool) Number of affected rows or false if the marker could not be updated
| Version | Description |
|---|---|
| 4.0 | Introduced |
Updates multiple markers
(int|bool) Number of affected rows or false if the markers could not be updated
| Version | Description |
|---|---|
| 4.0 | Introduced |
Assigns a marker to a map
(int|bool) Number of affected rows or false if the marker could not be assigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Assigns multiple markers to a map
(int|bool) Number of affected rows or false if the markers could not be assigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Assigns a marker to multiple maps
(int|bool) Number of affected rows or false if the marker could not be assigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Assigns multiple markers to multiple maps
(int|bool) Number of affected rows or false if the markers could not be assigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Assigns markers from an associative list
(int|bool) Number of affected rows or false if the markers could not be assigned
| Version | Description |
|---|---|
| 4.9 | Introduced |
Unassigns a marker from a map
(int|bool) Number of affected rows or false if the marker could not be unassigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Unassigns multiple markers from a map
(int|bool) Number of affected rows or false if the markers could not be unassigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Unassigns a marker from multiple maps
(int|bool) Number of affected rows or false if the marker could not be unassigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Unassigns all markers from a map
(int|bool) Number of affected rows or false if the markers could not be unassigned
| Version | Description |
|---|---|
| 4.0 | Introduced |
Unassigns a marker from all maps
(int|bool) Number of affected rows or false if the marker could not be unassigned
| Version | Description |
|---|---|
| 4.14 | Introduced |
Deletes a marker and its relationships
(int|bool) Number of affected rows or false if the marker could not be deleted
| Version | Description |
|---|---|
| 4.0 | Introduced |
Deletes multiple markers and their relationships
(int|bool) Number of affected rows or false if the markers could not be deleted
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the layer for the given ID
(object|null) Layer object or null if no result is found
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns all layers
This method has no parameters
(array) List of layer objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns all basemaps
This method has no parameters
(array) List of layer objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns all overlays
This method has no parameters
(array) List of layer objects
| Version | Description |
|---|---|
| 4.0 | Introduced |
Adds a layer
(int|bool) Layer ID or false if the layer could not be added
| Version | Description |
|---|---|
| 4.0 | Introduced |
Updates a layer
(int|bool) Number of affected rows or false if the layer could not be updated
| Version | Description |
|---|---|
| 4.0 | Introduced |
Deletes a layer
(int|bool) Number of affected rows or false if the layer could not be deleted
| Version | Description |
|---|---|
| 4.0 | Introduced |
Deletes orphaned relationships
This method has no parameters
(int|bool) Number of affected rows or false if the orphans could not be deleted
| Version | Description |
|---|---|
| 4.7 | Introduced |
Builds a valid marker object
(array) Marker object
| Version | Description |
|---|---|
| 4.9 | Introduced |
Sanitizes an array or comma-separated list of IDs
(array|string) List or CSV of sanitized IDs
| Version | Description |
|---|---|
| 4.0 | Introduced |
Builds and escapes an insert query from a list of data
(string) Escaped insert query
| Version | Description |
|---|---|
| 4.16 | Introduced |
Returns the layers table sanitization rules for prepare statements
This method has no parameters
(array) List of sanitization rules (column => rule)
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the maps table sanitization rules for prepare statements
This method has no parameters
(array) List of sanitization rules (column => rule)
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the markers table sanitization rules for prepare statements
This method has no parameters
(array) List of sanitization rules (column => rule)
| Version | Description |
|---|---|
| 4.0 | Introduced |
Returns the relationships table sanitization rules for prepare statements
This method has no parameters
(array) List of sanitization rules (column => rule)
| Version | Description |
|---|---|
| 4.0 | Introduced |
Subscribe to our newsletter to not miss any news - you can unsubscribe at any time: