diff --git a/projects/packages/jetpack-mu-wpcom/changelog/add-wpcom-difm-functions b/projects/packages/jetpack-mu-wpcom/changelog/add-wpcom-difm-functions new file mode 100644 index 0000000000000..82bc442049813 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/add-wpcom-difm-functions @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Adds DIFM-specific functionality for WoA sites diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 2d90701c8e3f1..b02683face54c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -110,6 +110,7 @@ public static function load_features() { require_once __DIR__ . '/features/wpcom-admin-dashboard/wpcom-admin-dashboard.php'; require_once __DIR__ . '/features/wpcom-block-editor/class-jetpack-wpcom-block-editor.php'; require_once __DIR__ . '/features/wpcom-block-editor/functions.editor-type.php'; + require_once __DIR__ . '/features/wpcom-difm/class-wpcom-difm-express.php'; require_once __DIR__ . '/features/wpcom-logout/wpcom-logout.php'; require_once __DIR__ . '/features/wpcom-themes/wpcom-theme-fixes.php'; diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-difm/class-wpcom-difm-express.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-difm/class-wpcom-difm-express.php new file mode 100644 index 0000000000000..b6ba18c594d25 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-difm/class-wpcom-difm-express.php @@ -0,0 +1,177 @@ + $submenu_items ) { + if ( $parent_slug === $wpcom_hosting_menu_slug ) { + foreach ( $submenu_items as $submenu_item ) { + if ( self::should_remove_submenu( $submenu_item[2] ) ) { + remove_submenu_page( $parent_slug, $submenu_item[2] ); + } + } + } + } + } + } + + /** + * Hide dashboard content if the DIFM sticker is active. + */ + public static function hide_dashboard_content() { + echo ''; + } + + /** + * Show an admin notice if the DIFM sticker is active. + */ + public static function show_difm_admin_notice() { + $domain = wp_parse_url( home_url(), PHP_URL_HOST ); + + $response = Client::wpcom_json_api_request_as_user( "sites/$domain/do-it-for-me/website-content" ); + if ( is_wp_error( $response ) ) { + return; + } + + $result = json_decode( wp_remote_retrieve_body( $response ) ); + + $is_website_content_submitted = $result->is_website_content_submitted ?? false; + + if ( $is_website_content_submitted ) : ?> +
Contact Support if you have any questions.', 'jetpack-mu-wpcom' ), 'mailto:services+express@wordpress.com' ) ); ?>
+
+
+
+
+ Contact Support if you have any questions.', 'jetpack-mu-wpcom' ), 'mailto:services+express@wordpress.com' ) ); ?>
+
+ "> +
+