Default Venue Country bug still exists on Community Events Submit Event Form

Home Forums Calendar Products Community Events Default Venue Country bug still exists on Community Events Submit Event Form

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1391757
    Sean
    Participant

    Hi,

    We had previously reported a bug that caused the Default Country to not be recognized by the Community Events Submit Event form: https://theeventscalendar.com/support/forums/topic/default-country-on-submit-an-event-form/
    Although the bug was fixed on the WP Admin page for adding a new event, the bug still exists on the Community Events Submit Event form (the dropdown shows “Select a Country” even when a default Country has been saved on the Community Settings.

    More importantly, Brook had previously provided us a workaround for setting the default country to be the United States and hiding the country dropdown. With the update to Community Events this summer, that template override no longer works.

    Can you please let us know of a snippet we can add to functions.php that will set the default Venue Country on the Community Events Submit Event form to be the United States?

    Thank you,
    Karly

    #1394190
    Victor
    Keymaster

    Hi Karly!

    Thanks for getting in touch with us! I’ll be happy to help you with this topic.

    I’ve just reviewed that other thread and it seems that things have changed quite a bit since then. Changes were made to the community templates, so the template override Brook shared is no longer applicable to our recent versions of the templates.

    I’ve tried to come up with a different template override to achieve the same, but it seems it’s now not achievable this way, and might require some additional coding. I will try to come up with a workaround for this and will come back to let you know about it.

    I think the fix not affecting the community add event form was intentional, but I will reach out to the team to have a second pair of eyes and confirm this, so I can be more certain about it when trying to come up with the workaround for your need.

    I will come back to you soon. Please hang in there.

    Thanks,
    Victor

    #1394342
    Sean
    Participant

    Thanks Victor. Looking forward to hearing how we can get the default country set on the Community Events form!

    Best,
    Karly

    #1395324
    Victor
    Keymaster

    Hi Karly!

    Thank you for your patience.

    I can confirm the fix was decided to not apply to the add event screen neither in the community form or the wp-admin form.

    We apologise for not having told you about the specifics when we notified you of the fix.

    The good news is I could come up with a workaround for it. You will need to create a new file called create-venue-fields.php and place it at [your-theme]/tribe-events/create-venue-fields.php directory within your theme directory. That file should contain the following code.

    https://gist.github.com/vicskf/216648911debcc2d84367c1a6ca84b00

    Then you should also add the following code into your theme’s functions.php file to make it work (also present in the previous gist):

    add_filter( 'tribe_events_tribe_venue_new_form_fields', 'custom_community_tribe_events_tribe_venue_new_form_fields' );
    
    function custom_community_tribe_events_tribe_venue_new_form_fields ( $template ) {
    	$template_directory = get_template_directory();
    	//Please make sure you place a file at [your-theme]/tribe-events/create-venue-fields.php directory within your theme directory
    	$template = $template_directory . '/tribe-events/create-venue-fields.php';
    
    	return $template;
    }

    I haven’t tested out much, so please give it a try before implementing in the live site and let me know if it works for you.

    Best,
    Victor

    #1396241
    Sean
    Participant

    Hi Victor,

    Thank you very much for putting this together. I really appreciate the time and effort. Unfortunately, after adding the respective code to functions.php and [your-theme]/tribe-events/create-venue-fields.php, after typing in a new venue name and clicking “Create [Venue Name typed]”, nothing happens. The Venue fields are not expanded, so it is not possible to create a new venue.

    Any change you can try it on your end when you have a chance?

    PS – On a related note, we are also using the filter described here (tribe_get_state_options) that was recently added to restrict which states are shown in the dropdown after selecting United States as the country. Not sure if that would in any way effect the Country dropdown?

    #1396640
    Victor
    Keymaster

    Hi Karly!

    Thanks for following up with this.

    I could not reproduce that issue on my end, even with your other code snippet in place. This sounds like it could be a Javascript error.

    I can’t access your site’s event submission form to see for myself because I’m required to be logged in so, could you please see if there are any console errors by inspecting the page? We have an article that explains how to do that here > https://theeventscalendar.com/knowledgebase/using-google-chrome-developer-tools/

    Also, try switching to a default theme and see if any difference.

    Let me know about it.

    Thanks,
    Victor

    #1396978
    Sean
    Participant

    Hi Victor,

    I tried to pinpoint the issue on my end and it seems that the default Avada theme (not customization’s in either functions.php or /tribe-events/) is causing the issue. In other words, with this custom workaround in place, the Venue fields don’t appear when using the default Avada theme with no customization’s. (FYI our site uses an Avada child theme with customization’s).

    Additionally, in all cases (1. Child Theme with customization’s, and 2. Default Avada theme with only this filter/function and php file added), no errors appeared in the Chrome dev tools Console.

    I’ve reverted back to our standard Child Theme with customization’s and removed the requirement to login. Is there any way you can take a look at the Submit Event page to see if you can spot anything?

    Thanks again,
    Karly

    #1397755
    Victor
    Keymaster

    Hi Karly!

    I’ve just realized the code snippet in the functions.php file won’t work for child themes. Please try changing it for the following code instead:

    add_filter( 'tribe_events_tribe_venue_new_form_fields', 'custom_community_tribe_events_tribe_venue_new_form_fields' );
    
    function custom_community_tribe_events_tribe_venue_new_form_fields ( $template ) {
    	$template_directory = get_stylesheet_directory();
    	//Please make sure you place a file at [your-theme]/tribe-events/create-venue-fields.php directory within your theme directory
    	$template = $template_directory . '/tribe-events/create-venue-fields.php';
    
    	return $template;
    }

    Please try it out and let me know if it works for you.

    Thanks,
    Victor

    #1397821
    Sean
    Participant

    Hi Victor,

    Thanks for this updated code. I tried it out and can confirm it is successfully hiding the Venue Country field and I am able to submit new Venues as well. The maps appear to be displaying correctly as well!

    However, I just want to confirm if in the backend/WP-admin the Venue Country should be displaying as empty (no value assigned)? I saw that in create-venue-fields.php there is code to hide and set the Venue Country to “United States”, so just wanted to confirm that no issues would crop up if the Country was in fact not set by this workaround.

    Thanks again,
    Karly

    #1398548
    Victor
    Keymaster

    Hi Karly!

    That’s a good catch. I can see that the Geo Address information gets saved correctly, thus showing the marker in the map view correctly, but I’m not able to see the City, Country, State and Postal Code information for the venues being saved when using the custom template.

    I’m not sure why this could be happening. I will make some additional tests and see what I can find. Please bear with me as I might need further assistance from the team on this one.

    I will keep you posted.

    Thanks,
    Victor

    #1399106
    Victor
    Keymaster

    Hi Karly!

    Thank you for your patience.

     

    It seems it was a Javascript issue that was causing the venue country to be empty. I managed to make a minor fix to the create-venue-fields.php file and it works on my end. I updated the gist to reflect that change, so please replace the older version for the one in the gist:

    https://gist.github.com/vicskf/216648911debcc2d84367c1a6ca84b00

    Let me know if that works for you know 🙂

    Best,
    Victor

    #1399421
    Sean
    Participant

    Good morning Victor,

    I tested the updated code and its working great on my end now as well. The Venue City, Country, State and Postal Code information is all there as expected 🙂

    Thanks again for this workaround so that we can set the default country to United States on the Community Events Submit Event form. Hopefully others will find this useful as well!

    Best regards,
    Karly

    #1399983
    Victor
    Keymaster

    Hi Karly!

    Glad to know it worked out for you! Thanks for following up to let me know about it.

    Absolutely, I hope others find it useful as well. 🙂

    I’ll go ahead and close this thread but feel free to open a new topic if anything comes up and we’ll be happy to help.

    Cheers!
    Victor

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Default Venue Country bug still exists on Community Events Submit Event Form’ is closed to new replies.