Support » Reviews » WP FullCalendar » doesn't work with multisite

  • Using events manager and wp-fullcalender the default events manager (ugly) calender pulls in the events from other sites, FullCalender is blank unless you add the event to the main site (which defeats the purpose of using a multisite)

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m experiencing the same problem with multisite installation. Can’t figure out how to fix it.

    The problem occurs because plugin pulls data via /wp-admin/admin-ajax.php. So, when your site’s primary domain is different from network’s http://www.example.com/wp-admin/admin-ajax.php when queried gives redirect to http://{SITEID}.{NETWORK_DOMAIN}/wp-admin/admin-ajax.php. Because of the restrictions of the Same-origin policy these does not work.

    There are 2 ways of solving the problem.

    ===========
    Solution #1
    ===========

    1. Go to Super Admin -> Domain mapping. And uncheck Redirect administration pages to site’s original domain. This will allow to have /wp-admin/ on the same primary domain.

    ===========
    Solution #2
    ===========

    Make a proxy.

    First of all change the ajaxurl, importing the WP_FullCalendar_localize_script to your theme’s functions.php (doing it this way will prevent ruining your configuration when plugin is updated)


    add_action('wp_enqueue_scripts','WP_FullCalendar_localize_script',11);
    function WP_FullCalendar_localize_script(){

    if( !is_admin() )
    {
    $js_vars = array();
    $js_vars['ajaxurl'] = get_bloginfo('stylesheet_directory') . "/proxy.php";

    /* .... everything else remains intact */

    And build a proxy that simply transfers all data to admin-ajax.php.


    <?php
    $query_string = $_SERVER['QUERY_STRING'];

    if (strlen($query_string) == 0)
    {
    $query_string = http_build_query($_POST);
    }

    $b = "";
    $fpp = fopen("http://SITEID.SITEDOMAIN/wp-admin/admin-ajax.php?".$query_string, "rb");
    while (!feof($fpp))
    {
    $b .= fgetc($fpp);
    }
    fclose($fpp);

    $b = str_replace('SITEID.SITEDOMAIN', 'PRIMARY DOMAIN FOR THIS SITE', $b);

    echo $b ."\r\n";
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘doesn't work with multisite’ is closed to new replies.