Calendar view AJAX switching between months does not work

Home Forums Calendar Products Events Calendar PRO Calendar view AJAX switching between months does not work

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1535390
    tshapiro
    Participant

    I’m using Events Calendar Pro with a custom theme that I built. When I try and switch between months the AJAX call just hangs with the loading icon and never goes through.
    Here are some details about the troubleshooting I have done so far:
    It works fine when logged into WordPress, but not when logged out. This made me think it was a caching related issue so I reached out tot he host and asked them to exclude that page from caching but that did not fix the issue.
    I tried switching to the default twentysixteen theme on a staging environment and that fixed the issue so I am confident the problem has something to do with my theme. The theme for the site that the calendar is on is a custom child theme I built off of a custom parent theme I also built.
    Now that I know it is probably an issue with my custom theme I figured it was related to a javascript conflict so I reset the staging environment and commented out all of the javascript files being loaded in both the parent theme and the child theme in the functions.php files, but that did not fix the issue either.
    Then I tried also disabling all plugins except for advanced custom fields (since my theme uses it so heavily the site won’t really load without the plugin being active) and still no luck.

    I finally reset the staging environment again and tested disabling the AJAX on the calendar using a snippet I found on the forums here and the calendar now switches between months fine without AJAX.

    Could the issue possibly have to do with something PHP related? I figured since the error I’m getting is related to the AJAX call that the issue had to be JS related.

    Any insight you can provide would be really helpful.

    #1536061
    Sky
    Keymaster

    Hi there!

    I’m sorry to hear that you’re having difficulties with the plugin working with your theme. I will try to help figure out the problem.

    I took a look at your site, but it seems you have disabled ajax loading, so I am unable to see the issue happening. In general, I would suspect a JS issue in a case like this, but there are other potential causes.

    When you say it was working for you when logged in, but not otherwise, were you viewing the site at the https url in both cases? Do you have the site urls in WordPress settings set to use https? If you look at the page and view the console, do you see a “file not found” error for the ajax.php file after trying to navigate to the next month?

    Thanks,
    Sky

    #1543914
    tshapiro
    Participant

    This reply is private.

    #1544136
    Sky
    Keymaster

    Hi again,

    I did take a look, and am seeing no errors in the console. It seems to get stuck on the ajax call and never completes or returns anything.

    Unfortunately, we are limited in the amount of support we can provide for third party themes and plugins. If it is working correctly with a default theme, and there are no errors for me to go on, there’s not much more I’ll be able to suggest. Definitely see what happens without ACF running, just to test. I haven’t heard of anyone having a problem like this with ACF, but there may be something in the way it is being implemented in your theme.

    Other than that, I would try disabling functions or scripts in your theme one at a time until you see a change in the behavior, and investigate from there.

    Good luck, and let me know if you have any specific questions about the calendar functionality.

    Thanks,
    Sky

    #1544181
    tshapiro
    Participant

    I bought a pro license just to get your help debugging so I feel very disappointed by your lack of help.

    #1544185
    tshapiro
    Participant

    Also, I want to stress that this functionality was working when I started using the plugin and stopped working after an update so I think it’s definitely something to do with your code (and my code) not playing well.

    #1544216
    Sky
    Keymaster

    Hi again,

    I’m sorry to hear that you feel that way. Please review what types of things we can help with in the support forums by reading this page: https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/.

    If you had a specific error or other information to go on, I might be able to help. But it is not feasible for me to run through your custom theme line by line looking for problems with your code.

    Are there any errors showing in your debug.log file? This may shed some light on the issue.

    Again, if you have any specific questions, please let me know and I’ll do my best to help.

    Thanks,
    Sky

    #1544243
    tshapiro
    Participant

    I found the PHP code that was causing the issue:

    `function cfabw_dashboard_redirect() {
    // bail early if user can access WP admin section
    if( cfabw_user_level_is(‘administrator’) || cfabw_user_level_is(‘country_admin’) ) {
    return;
    }

    global $pagenow;
    if( ‘profile.php’ != $pagenow ) {
    $dashboard_page_id = cfabw_get_page_id_by_template(‘admin-template-dashboard.php’);
    wp_redirect( get_page_link($dashboard_page_id) );
    exit;
    }
    }
    add_action( ‘admin_init’, ‘cfabw_dashboard_redirect’);’

    The code is meant to redirect users who are not administrators to a custom dashboard created for the site. We don’t want users who are not admins to be able to access the default WordPress dashboard…

    Do you have any idea why this code was breaking the AJAX function? I would really appreciate it if you could help me figure out what I’m doing wrong here.

    #1545582
    Sky
    Keymaster

    Hi again,

    Glad to hear that you found the code that was causing the issue!

    Looking at the WP documentation for ‘admin_init’ it says the following:

    Note, this does not just run on user-facing admin screens. It runs on admin-ajax.php and admin-post.php as well.

    It’s likely that you’re redirecting the ajax calls, and that you need to either try a different hook or expand your conditionals to detect when it’s an ajax call.

    Hope that helps!

    Thanks,
    Sky

    #1561843
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Calendar view AJAX switching between months does not work’ is closed to new replies.