Hi Subhankar,
I consulted our dev team and they sent me the following input:
// Hook: used in child site.
add_filter( 'mainwp_site_sync_others_data', 'myhook_sync_others_data', 10, 2 );
function myhook_sync_others_data( $information, $data = array() ){
if ( isset( $data['syncMyData'] ) && $data['syncMyData'] ) {
try {
$information['syncMyData'] = array( 'my_site_size' => 123456 ); // collect data here.
} catch ( \Exception $e ) {
// ok!
}
}
return $information;
}
// Hooks: used in dashboard.
add_filter( 'mainwp_sync_others_data', 'myhook_mainwp_sync_others_data', 10, 2 );
function myhook_mainwp_site_synced( $data, $website ) {
$data['syncMyData'] = true;
return $data;
}
add_action( 'mainwp_site_synced', 'myhook_mainwp_site_synced', 10, 2 );
function myhook_mainwp_site_synced( $website, $information = array() ) {
if (is_array( $information ) && isset( $information['syncMyData'] ) ) {
$site_size = $information['syncMyData']['my_site_size'];
apply_filters( 'mainwp_updatewebsiteoptions', false, $website, 'my_site_size', $site_size );
}
}
// show data like this:
function show_my_data( $website ){
$site_size = apply_filters( 'mainwp_getwebsiteoptions', false, $website, 'my_site_size' );
echo $site_size;
}