vikdiesel
Forum Replies Created
-
Forum: Reviews
In reply to: [WP FullCalendar] doesn't work with multisiteThe problem occurs because plugin pulls data via /wp-admin/admin-ajax.php. So, when your site’s primary domain is different from network’s https://www.example.com/wp-admin/admin-ajax.php when queried gives redirect to https://{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("https://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";
?>Forum: Reviews
In reply to: [WP FullCalendar] doesn't work with multisiteI’m experiencing the same problem with multisite installation. Can’t figure out how to fix it.