Open killua99 opened 5 years ago
I debug the thing, you are fetching the bundle list via admin-ajax.php
Since you load the bundle and create then via AJAX, the ajax realm is outsite multisite.
Check the load.php (WordPress)
/**
* Whether the current request is for the network administrative interface.
*
* e.g. `/wp-admin/network/`
*
* Does not check if the user is an administrator; current_user_can()
* for checking roles and capabilities.
*
* @since 3.1.0
*
* @global WP_Screen $current_screen
*
* @return bool True if inside WordPress network administration pages.
*/
function is_network_admin() {
if ( isset( $GLOBALS['current_screen'] ) )
return $GLOBALS['current_screen']->in_admin( 'network' );
elseif ( defined( 'WP_NETWORK_ADMIN' ) )
return WP_NETWORK_ADMIN;
return false;
}
and when you construct
<?php
class WPCFM_Options
{
public $is_network = false;
function __construct() {
// WP-CLI --network handler
$argv = isset( $_SERVER['argv'] ) ? $_SERVER['argv'] : array();
$has_network_flag = ( false !== array_search( '--network', $argv ) );
// Network admin
if ( is_network_admin() || $has_network_flag ) {
$this->is_network = true;
}
}
Will fail, since admin-ajax.php is outsite * e.g. /wp-admin/network/
Solution would be, remove admin.js script from the template page-settings.php and add the javascript properly.
Using the functions:
wp_enqueue_script(); wp_localize_script();
That way we pass a variables saying which screen we are, if is a network realm or not.
You might close this issue
Network settings are been saved under blog1 instead network.
I'm located at this address: /wp-admin/network/settings.php?page=wpcfm
Create a new bundle and save it, and it saved as blog1 instead network.
Shall I build something to be able to save network settings correctly?