L
L
lakegull2016-01-14 00:51:35
WordPress
lakegull, 2016-01-14 00:51:35

Is it possible to install two identical plugins on the same site?

There is a plugin that creates Google maps with markers and other elements. The problem is that it does not allow you to apply different settings for each of the generated maps. There is a need to disable some features in one map, but leave them in another. The plugin creates shortcodes that differ by card ID.
At first I thought to just rename the archive with the plugin, for example gimap2.zip instead of gimp.zip, and install it in a different folder in this way, but what to do with the same shortcodes? If both plugins create a [gimap id='1'] shortcode, then obviously it will throw an error.
Can you tell me how to rename the shortcode of the second plugin to [gimap2 id='1'] ?
Do I still need to rename any CSS classes or files in the duplicate plugin?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
lakegull, 2016-01-14
@lakegull

Thanks everyone for the tips, I've found the solution.
Initially, the actions I proposed were absurd. The effort expended and the result would be like a symbiosis of crutches and a bicycle - a wheelchair.
After digging into the code, I realized that you can directly set the parameters of the created map through the Google Maps API.
In the personal settings of the map there is a drop-down menu with the ability to select Basic Map Types from four proposed options: ROADMAP, SATELLITE, HYBRID and TERRAIN.
A piece of the required JS code in each of the map types looks like this:

if (override_type === "HYBRID") { 
                var myOptions = {
                        zoom:zoom,
                        minZoom: wpgmza_max_zoom,
                        maxZoom: 21,
                        center: latLng,
                        draggable: wpgmza_settings_map_draggable,
                        disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
                        scrollwheel: wpgmza_settings_map_scroll,
                        zoomControl: wpgmza_settings_map_zoom,
                        panControl: wpgmza_settings_map_pan,
                        mapTypeControl: wpgmza_settings_map_type,
                        streetViewControl: wpgmza_settings_map_streetview,
                        mapTypeId: google.maps.MapTypeId.HYBRID
                };
            }

I needed a HYBRID map type, but with the controls disabled.
I made a copy of the HYBRID code and pasted it just below, then renamed the type to my own (PERSONAL), disabled the controls. The result is this code:
if (override_type === "PERSONAL") {
                var myOptions = {
                        zoom:zoom,
                        minZoom: wpgmza_max_zoom,
                        maxZoom: 21,
                        center: latLng,
                        draggable: false,
                        disableDoubleClickZoom: true,
                        scrollwheel: false,
                        zoomControl: false,
                        panControl: false,
                        mapTypeControl: false,
                        streetViewControl: false,
                        mapTypeId: google.maps.MapTypeId.ROADMAP
                };
            }

In other PHP and JS files, I also added the necessary code so that PERSONAL appears in the drop-down list of settings. I found all the places where I need to add code using the ROADMAP tag, going through the entire plugin, creating a copy of the existing lines and renaming them properly.
As a result, the goal was achieved.

M
Mr Crabbz, 2016-01-14
@Punkie

Unlikely. Especially if the plugin stores something in the database from itself. You will have to shovel the entire plugin, change all global variables, change the names of fields or tables, etc.

M
Maxim Kudryavtsev, 2016-01-14
@kumaxim

The method, of course, is not entirely correct and can cause a bunch of side glitches on the site ... Although, for the most part, it depends on where this plugin is and what it writes.
After these manipulations, go to the WP amdinka on the "Plugins" page. These two copies of yours will be displayed there. Activate them.
Although if the plugin works with shortcodes, I'm not sure if two of its copies work simultaneously, they may overwrite each other's data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question