Help Desk

Uncheck google maps by default (venue details) – Community Events

  • Posts: 2 Topics: 1
    | Permalink

    Hello,

    We recently purchased the Community Events plugin. I have been customising it for our use cases and it generally looks good now.

    But I notice when events are created via the Community Events form, they go in with the Google Maps link and display checked on the event (venue details). See attached screenshot.

    These are usually wildly inaccurate and we like to turn this off by default on our events. We actually organise photo shoots for our community and getting the location right is critical for us.

    What is your recommended approach to customise these to be turned off / unchecked when creating a new event via Community Events?

    Kind regards
    Arun

    • This topic was modified 4 months ago by  focusphoto. Reason: clarified more info
    Posts: 144
    | Permalink

    Hey there.

    First of all welcome to the support forums. This can be done via WordPress hooks so you need to paste a little snippet of code in your functions.php in your active theme.

    function tribe_community_event_remove_default_map_options( $event_id ) {
        $venue_id = tribe_get_venue_id( $event_id );
        update_post_meta( $venue_id, '_VenueShowMapLink', 'false' );
        update_post_meta( $venue_id, '_VenueShowMap', 'false' );
    }
    // This will remove the default options only on new commuity events created
    add_action( 'tribe_community_event_created', 'tribe_community_event_remove_default_map_options' );
    

    The code above will make sure every new community event created will remove those 2 default options however if you want to do that as well every time a new community event is updated as well you need to add the following line of code as well.

    add_action( 'tribe_community_event_updated', 'tribe_community_event_remove_default_map_options' );
    

    Let me know if you have any questions about this.

    Best and happy holidays.
    Crisoforo

    Posts: 2 Topics: 1
    | Permalink

    Hi there,

    Thanks for your reply. Okay I have applied both those do_action hooks, and it is partly working.

    It appears that the VENUE does get created (and also on edits) with the Google Maps disabled.

    However on the Event itself, there are another set of checkboxes which are not getting disabled. See attached screenshot.

    I have also tried adding in these lines, in addition to the $venue_id lines you originally sent. Unfortunately adding these in does not disable the checkboxes on the Event either. Only on the venue details.

    update_post_meta( $event_id, '_VenueShowMapLink', 'false' );
    update_post_meta( $event_id, '_VenueShowMap', 'false' );

    Rehards
    Arun

    • This reply was modified 4 months ago by  focusphoto.
    • This reply was modified 4 months ago by  focusphoto. Reason: Updated info
    Posts: 2 Topics: 1
    | Permalink
    Correct Answer

    Hi there,

    Okay I got it working, I had to add in some additional lines into the function. This seems to make it work:

    update_post_meta( $event_id, '_EventShowMapLink', 'false' );
        update_post_meta( $event_id, '_EventShowMap', 'false' );

    Thanks for sorting this out for us!

    Regards
    Arun

    Posts: 144
    | Permalink

    Awesome!

    I’m glad I was able to give you some help on this one.

    | Permalink

The topic ‘Uncheck google maps by default (venue details) – Community Events’ is closed to new replies.