Javascript Errors on Add Event Page Only

Home Forums Calendar Products Community Events Javascript Errors on Add Event Page Only

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #109190
    andreafph
    Participant

    Running into some errors after activation Events Calendar Pro + Community Events.
    “TypeError: $(…).live is not a function
    $(‘.ui-dialog-titlebar .ui-dialog-titlebar-close’).live(‘click’, function() {”
    Line 73: events-calendar-pro/resources/events-admin.js?ver=3.4

    #109388
    Barry
    Member

    Hi!

    It looks like your theme or possibly another plugin is replacing the version of the jQuery library (which is a set of code WordPress and many plugins like our own requires) with a different version being pulled in from Google:

    <script type='<a>text/javascript</a>' src='<a href="view-source:http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js?ver=3.8.1">http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js?ver=3.8.1</a>'></script>

    Based on the troubleshooting steps you indicated having completed so far my guess would be your theme is responsible for this: can you investigate removing this so that WordPress’s own (and more recent) version of the library is used? I suspect that will solve this.

    Let us know how you get on!

    #109488
    andreafph
    Participant

    The theme relies on the google.js– removing it breaks the site. It seems that only the community form/add page has a conflict with an essential plugin that I can resolve if I knew how to designate a different template to the form page only, so that I could disable the plugin on that one page. I have a custom default template for the event pages and it works well. How can I add a custom default template for the add/form page? I will attempt to try this solution, but what folder/directory do create this in?

    #109491
    andreafph
    Participant

    Sorry, to clarify, I would like to know how to direct the form/add event page to a different template than the regular events template I have set in the dashboard/settings.

    #109517
    andreafph
    Participant

    Lastly, if I deactivate pro and just keep community and standard events cal plugins, there are no errors.

    #109520
    andreafph
    Participant

    Okay so I kept coming across solutions that said that .live is deprecated and to use .on instead. I updated this in the event-admin.js file and everything is working. HOWEVER, I would still like to know how to switch to a different template for both ‘add’ page and ‘edit event’ page so I can use a full width template, rather than one w/ sidebars (which is fine for the list view pages, etc.) I can start a new topic if necessary.

    #109887
    Barry
    Member

    Hi!

    You can specify a different template with a filter. To use the default page template for instance (but only for Community Events views) you could do:

    add_filter( 'tribe_events_community_template', 'comm_events_tpl' );
    function comm_events_tpl() { return 'page.php'; }

    Does that help?

    #109990
    andreafph
    Participant

    Getting closer…I’ve been working out some kinks in the backend…is there any way to specifically target a: the form only, and b: the edit page ‘My Events’ ?

    *Also, I’m not seeing the line w/ ‘Not an evil spammer’ nor the checkbox. I’ve found someone’s site who is showing this and am rummaging around the code to see why it’s not showing in my view (while logged out, and anonymous submissions are being accepted in settings)

    #110318
    Barry
    Member

    You should be able to differentiate, yes – check out the list of available functions, there are some useful template tags like tribe_is_community_edit_event_page():

    docs.tri.be/Community-Events

    We do try to stick to one issue per thread – it helps us to stay focused on solving the problem at hand and also to ensure fair service for all our users – so for any other topics such as help with the anti-spam control please create a fresh thread – thanks!

    #110690
    andreafph
    Participant

    Thank you for this. I’ll need a little more guidance on directing the ‘my events’ page to another template- I’ve tried in my functions.php:
    add_filter( ‘tribe_is_community_my_events_page’, ‘comm_events_tpl’ );
    function comm_events_tpl() { return ‘single-fullwidth.php’; }

    But I get an error that I ‘Cannot redeclare tribe_is_community_my_events_page()’ as it’s already called from tribe-community-events-template-tags.php

    And in tribe-community-events-template-tags.php I’ve also tried:
    function tribe_is_community_my_events_page() {
    $tce = TribeCommunityEvents::instance();

    return ‘single-fullwidth.php’;
    }

    And:
    function tribe_is_community_my_events_page() { return ‘single-fullwidth.php’; }

    The single-wp_router_page class is still being applied to the body and the selected template from settings is still being grabbed.

    Please take your time in getting back to me. This is no longer as urgent as I was able to make some modifications so the front end is good to go and for now I will be the only one seeing the ‘My Events’ page. So close! This plugin is very much worth the $ and effort to get it going full steam. Thanks!

    #110766
    Barry
    Member

    OK, so it sounds like you’re getting close and just have a few wrinkles to iron out here.

    add_filter( ‘tribe_is_community_my_events_page’, ‘comm_events_tpl’ );
    function comm_events_tpl() { return ‘single-fullwidth.php’; }

    Please note that tribe_is_community_my_events_page() is a function rather than a filter or hook name and so can’t really be used successfully in this form.

    But I get an error that I ‘Cannot redeclare tribe_is_community_my_events_page()’ as it’s already called from tribe-community-events-template-tags.php

    Right, so in your second snippet it seems you tried to define your own function, also named tribe_is_community_my_events_page and that will certainly cause an issue – in PHP, you may not define two functions of the same name.

    It’s fantastic that you’re digging into this and are making headway but, I think, realistically you’re going to need a little more support on the coding side than we can really provide here. I hope you understand our position on that one and that you persevere further, I’m sure you’ll get there 🙂

    Good luck!

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Javascript Errors on Add Event Page Only’ is closed to new replies.