Okay
  Public Ticket #2587138
Completely Disable Direction & Geolocation Features
Closed

Comments

  •  2
    Daniel started the conversation

    Hi,

    I would like to be able to completely remove the directions feature for event locations as well as the use of the geolocation feature on there, as the former is not needed on our site and the letter has raised privacy concerns with our users.

    Right now, as far as I know, my only workaround is to remove those from the PHP and JavaScript files manually, but this is obviously not an ideal solution, especially because I have to do it again with each update.


    Thanks,
    Daniel

  •  894
    Zhivko replied

    Hi,

    1) Go to Dashboard -> STEC -> Fonts & Colors and add following css:

    .stec-layout-event-inner-location-left input, 
    .stec-layout-event-inner-location-left a,
    .stec-layout-event-inner-location-left-title:nth-child(3) {
      visibility: hidden !important;
    } .stec-layout-event-inner-location-direction-error,
    .stec-media-med .stec-layout-event-inner-location-left input, 
    .stec-media-med .stec-layout-event-inner-location-left a,
    .stec-media-med .stec-layout-event-inner-location-left-title:nth-child(3),
    .stec-media-small .stec-layout-event-inner-location-left input, 
    .stec-media-small .stec-layout-event-inner-location-left a,
    .stec-media-small .stec-layout-event-inner-location-left-title:nth-child(3) {
      display: none !important;
    } .stec-layout-single-location-right { display: none !important; } .stec-layout-single-location-left { width: 100% !important; } .stec-layout-single-location-flex { width: 100%; }


    2) Open your theme or child-theme functions.php file and add the code from the text file I've attached.



    Stachethemes Developer

  •  2
    Daniel replied

    Hi,

    I just updated to version 3.2.0 and the browser still asks for location access when switching to the location tab in an event. So I guess the code for that did not work?

    Also, while the CSS code hides the direction & map elements from the location tab, they still occupy the same space in the tab, resulting in a lot of blank space in the tab. Is there a fix for that?

  •  894
    Zhivko replied

    Hi,

    Remove the old modifications.

    Try out this one instead:

    1) CSS:

    .stec-layout-event-inner-location-left {  display: none !important; }
    .stec-layout-event-inner-location-right { position: static !important; min-height: 400px; } .stec-layout-single-location-right { display: none !important; }
    .stec-layout-single-location-left { width: 100% !important; }
    .stec-layout-single-location-flex { width: 100%; }

    2) Code:

    add_action('wp_footer', function() {
        if (wp_script_is('stec-db-js')) {
            ?>
            <script type="text/javascript">
                (function ($) {
                    const myLocation = 'none';
                    $(function () {
                        if (typeof $.stecExtend === 'function') {
                            $.stecExtend(function (m) {
                                m.glob.options.myLocation = myLocation;
                            });
                        } else {
                            window.stecSingleOptions.myLocation = myLocation;
                        }
                    });
                })(window.jQuery);
            </script>
            <?php
        }
    });

    Stachethemes Developer

  •  2
    Daniel replied

    The code works now, thanks! The CSS however now hides the location completely from the tab and still leaves the blank space.

  •  894
    Zhivko replied

    May I take a look at your front calendar page?


    Stachethemes Developer

  •   Daniel replied privately
  •  894
    Zhivko replied

    The problem is that the map is not rendered at all.

    Google Maps api key value is empty and I assume Load Google Maps script is disabled as well in STEC -> General -> Misc.

    If you don't want to use Google Maps you can switch to OpenStreeMap from STEC -> General -> Map Type.


    Stachethemes Developer

  •  2
    Daniel replied

    The Map Type is already set to OpenStreetMap. However, I have both the Google Maps and the OSM script disabled in the Misc tab.

    Just to clarify: What I want to achieve is no map and directions on the location tab at all, I just want to display the location name and details.

  •  894
    Zhivko replied

    Remove the css and replace it with this one:

    .stec-layout-event-inner-location-left {width: 100% !important;}
    .stec-layout-event-inner-location-physical {width: 100%;}
    .stec-layout-event-inner-location-left-title:not(:first-of-type),
    .stec-layout-event-inner-location-physical a,
    .stec-layout-event-inner-location-physical input {display: none;}
    .stec-layout-event-inner-location-address { margin-bottom: 0 !important; }
    .stec-layout-event-inner-location-direction-error { display: none; }
    .stec-layout-event-inner-location-right { display: none !important; } .stec-layout-single-location-right {display: none !important;}
    .stec-layout-single-location-left {width: 100% !important;}
    .stec-layout-single-location-directions-title,
    .stec-layout-single-location .stec-layout-single-location-flex:last-child {
        display: none !important;
    }

    I'll make sure to do this behavour as default if no map script is loaded...


    Stachethemes Developer

  •  2
    Daniel replied

    Thank you, that almost did the trick, just had to add

    .stec-layout-event-inner-location-left .stec-layout-event-input-fontandcolor { display: none !important; }
    .stec-layout-single-location-left .stec-layout-event-input-fontandcolor { display: none !important; }

    to make the start and destination input boxes disappear.

    Thanks again for your quick help!