City Default Content Not Working

Home Forums Calendar Products Events Calendar PRO City Default Content Not Working

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1143463
    Ben
    Participant

    In the latest version of Events Calendar Pro, the city default content is not working. The files attached show the bug.

    #1143867
    Nico
    Member

    Hi there Gene,

    Thanks for reaching out to us and thanks for the report!

    I could confirm this is a legit bug as I was able to reproduce it in my local install as well. I went ahead and logged this bug in the system, I also attached this thread to the ticket so you’ll get a heads up when a fix for this is available.

    Thanks once again for the report,
    Best,
    Nico

    #1154186
    Ben
    Participant

    Any forecast on when this will be fixed?

    #1154480
    Nico
    Member

    Hey Gene,

    Thanks for reaching out once again! There’s still no date set for the fix of this issue, moreso due to some related tickets the ‘Default Content’ feature is being revisited and might end up redefined a bit. I’ll probably have more news on this later this week, I’ll let you know when I have some more info on this.

    Best,
    Nico

    #1167626
    Ben
    Participant

    Any news on fix for City and State default not working?

    #1168129
    Nico
    Member

    Hey Gene,

    Thanks for keeping this in mind and sorry for not having news about this yet πŸ™

    I took some time and coded a temporary solution for you. Just paste the code below to your theme’s (or child theme’s) functions.php file and it will add the city default value to the ‘add event’ screen:

    /* Tribe, add default city to the new events venue city value */
    function admin_footer_js( ) {

    if( !isset($_GET['post_type']) || 'tribe_events' != $_GET['post_type'] ) return false;

    $screen = get_current_screen();

    if ( 'add' != $screen->action ) return false;

    $default_city = tribe_get_option( 'eventsDefaultCity', '' );

    if ( $default_city == '' ) return false;

    ?>

    <script type="text/javascript">

    jQuery('document').ready ( function ( $ ) {

    $('input[name="venue[City][]"').val('<?php echo $default_city; ?>');

    });

    </script>

    <?php
    }

    add_action( 'admin_print_footer_scripts', 'admin_footer_js' );

    Please give a try and let me know if this solves the issue for now and if the code can be enhanced to account for other scenarios,
    Have a great weekend,
    Nico

    #1168375
    Ben
    Participant

    Thanks for your help Nico. I’m getting this error:

    Parse error: syntax error, unexpected ‘&’ in /home/jsowebmaster/jazzoregon.com/wp-content/plugins/JSO-updates/JSO-updates.php on line 47.

    Here is line 47: if ( ‘add’ != $screen->action ) return false;

    Must be a typo somewhere.

    Could I also fix state and country by duplicating the code and making these changes…

    eventsDefaultCity –> eventsDefaultState, eventsDefaultCountry?
    venue[City][] –> venue[State][], venue[Country][]
    $default_city –> $default_State, $default_Country

    Gene

    #1168377
    Ben
    Participant

    P.S. Line 47 actually looks like this:

    if ( ‘add’ != $screen->action ) return false;

    Somehow the &gt got converted to > when I entered the code in the Forum.

    #1168775
    Nico
    Member

    Thanks for following up Gene!

    I’ve added the state and country fields to the snippet (the change is not so lineal):

    /* Tribe, set default values for venues in new event page */
    function tribe_set_default_values( ) {

    // bail if we are not in an events page
    if( !isset($_GET['post_type']) || 'tribe_events' != $_GET['post_type'] ) return false;

    $screen = get_current_screen();

    // bails if it's not Add Event page
    if ( 'add' != $screen->action ) return false;

    // bail if PRO is not active
    if ( !class_exists('Tribe__Events__Pro__Default_Values') ) return false;

    $defaults = new Tribe__Events__Pro__Default_Values;

    $default_city = $defaults->city();
    $default_state = $defaults->state();
    $default_country = $defaults->country();
    $default_country = $default_country[1];

    ?>

    <script type="text/javascript">

    jQuery('document').ready ( function ( $ ) {

    $('input[name="venue[City][]"]' ).val('<?php echo $default_city; ?>');

    $('select[name="venue[Country][]"]').val('<?php echo $default_country; ?>');
    $('select[name="venue[Country][]"]').change();

    $('select[name="venue[State]"]' ).val('<?php echo $default_state; ?>');
    });

    </script>

    <?php
    }

    add_action( 'admin_print_footer_scripts', 'tribe_set_default_values' );

    Replace the snippet I sent before and try this one instead. Regarding the error description you sent I’m curious why the path to the error is ‘/plugins/JSO-updates/JSO-updates.php’ and not the functions.php file from your theme (or child theme). Anyway try pasting the code snippet in a plain text editor and then copy it over to the actual functions.php file.

    Please let me know if it works as expected now,
    Best,
    Nico

    #1168833
    Ben
    Participant

    Yes, this works. The first time some of the text got converted in the email message (< and > converted to &lt &gt). I went back to the support forum and copied from there and it works fine. I placed the code in a patch plugin to isolate it form the Illustrious code, which gets updated from time to time. Thanks for your help! Gene

    #1169170
    Nico
    Member

    Nice! Thanks for the heads-up Gene and glad to hear I could provide a workaround until this feature can be revisited πŸ™‚

    Do you think we are in a good spot to close out this thread?

    Please let me know about it,
    Best,
    Nico

    #1169292
    Ben
    Participant

    This reply is private.

    #1169388
    Nico
    Member

    Thanks for confirming Gene πŸ™‚

    I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.

    Best,
    Nico

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘City Default Content Not Working’ is closed to new replies.