woogc/show_network_orders
Name: woogc/show_network_orders
Type: Filter
Arguments: $status
The filter can be used to show the Network Orders interface to other shops in the MultiSite environment.
The following code example, show the interface for shops ID’s 2 and 3:
add_filter('woogc/show_network_orders', 'WooGC_show_network_orders');
function WooGC_show_network_orders( $status )
{
global $blog_id;
if ( in_array ( $blog_id , array ( 2, 3 ) ) )
return TRUE;
return $status;
}
The following code example, show the interface for user ID 40:
add_filter('woogc/show_network_orders', 'WooGC_show_network_orders_for_users');
function WooGC_show_network_orders_for_users( $status )
{
global $userdata;
if ( in_array ( $userdata->ID , array ( 40 ) ) )
return TRUE;
return $status;
}
Multiple conditions can be checked before allowing the interface, this code check for user 40 and allow only on site ID 2
add_filter('woogc/show_network_orders', 'WooGC_show_network_orders_for_users');
function WooGC_show_network_orders_for_users( $status )
{
global $userdata, $blog_id;
//Presume all conditions are correct
$status = TRUE;
if ( in_array ( $userdata->ID , array ( 40 ) ) )
$status = FALSE;
if ( in_array ( $blog_id , array ( 2 ) ) )
$status = FALSE;
return $status;
}
The code should be placed inside a php file on wp-content/mu-plugins folder.
