Skip to content

Commit 9c18667

Browse files
authored
Stats: Remove "Jetpack > Stats" menu (#45607)
Removes the deprecated "Jetpack > Stats" menu since the new top-level Stats menu has been live one month.
1 parent fc23c52 commit 9c18667

File tree

4 files changed

+8
-43
lines changed

4 files changed

+8
-43
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: removed
3+
4+
Stats: Remove "Jetpack > Stats" menu

projects/packages/stats-admin/src/class-dashboard.php

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Automattic\Jetpack\Stats_Admin;
99

10-
use Automattic\Jetpack\Admin_UI\Admin_Menu;
1110
use Automattic\Jetpack\Stats\Options as Stats_Options;
1211

1312
/**
@@ -48,7 +47,6 @@ public static function init() {
4847
public function init_hooks() {
4948
self::$initialized = true;
5049
// Jetpack uses 998 and 'Admin_Menu' uses 1000.
51-
add_action( 'admin_menu', array( $this, 'add_wp_admin_submenu' ), $this->menu_priority );
5250
add_action( 'admin_menu', array( $this, 'add_wp_admin_menu' ), $this->menu_priority );
5351
}
5452

@@ -82,39 +80,6 @@ public function add_wp_admin_menu() {
8280
}
8381
}
8482

85-
/**
86-
* The page to be added to submenu
87-
*/
88-
public function add_wp_admin_submenu() {
89-
$page_suffix = Admin_Menu::add_menu(
90-
__( 'Stats', 'jetpack-stats-admin' ),
91-
_x( 'Stats', 'product name shown in menu', 'jetpack-stats-admin' ),
92-
'view_stats',
93-
'callout-stats',
94-
array( $this, 'render_callout' )
95-
);
96-
97-
if ( $page_suffix ) {
98-
add_action( 'load-' . $page_suffix, array( $this, 'admin_init' ) );
99-
}
100-
}
101-
102-
/**
103-
* Add the render callout function. We need to pass the location.hash to the stats moved page.
104-
*
105-
* This code is temporary and will be removed after a month.
106-
*
107-
* @return void
108-
*/
109-
public function render_callout() {
110-
?>
111-
<script>
112-
location.hash = '#!/stats/moved?page=callout-stats';
113-
</script>
114-
<?php
115-
$this->render();
116-
}
117-
11883
/**
11984
* Override render funtion
12085
*/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: other
3+
4+

projects/plugins/jetpack/tests/php/general/Jetpack_Admin_Menu_Test.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,16 @@ public function test_jetpack_admin_menu_order() {
7272

7373
$submenu_names = array_column( $submenu['jetpack'], 3 );
7474
// Capture the positions of these submenu items.
75-
$stats_submenu_position = array_search( 'Stats', $submenu_names, true );
7675
$videopress_submenu_position = array_search( 'Jetpack VideoPress', $submenu_names, true );
7776
$backup_submenu_position = array_search( 'Jetpack VaultPress Backup', $submenu_names, true );
7877
$search_submenu_position = array_search( 'Jetpack Search', $submenu_names, true );
7978
$settings_submenu_position = array_search( 'Settings', $submenu_names, true );
8079

81-
// Some sites - multisites / WoA for example - may not have all of the menu items.
82-
if ( in_array( 'My Jetpack', $submenu_names, true ) ) {
83-
$my_jetpack_submenu_position = array_search( 'My Jetpack', $submenu_names, true );
84-
$this->assertLessThan( $stats_submenu_position, $my_jetpack_submenu_position, 'My Jetpack should be above Stats in the submenu order.' );
85-
}
86-
8780
if ( in_array( 'Activity Log', $submenu_names, true ) ) {
8881
$activity_log_submenu_position = array_search( 'Activity Log', $submenu_names, true );
8982
$this->assertLessThan( $search_submenu_position, $activity_log_submenu_position, 'Activity Log should be above Search in the submenu order.' );
9083
$this->assertLessThan( $activity_log_submenu_position, $backup_submenu_position, 'Jetpack VaultPress Backup should be above Activity Log in the submenu order.' );
9184
}
92-
$this->assertLessThan( $videopress_submenu_position, $stats_submenu_position, 'Stats should be above VideoPress in the submenu order.' );
9385
$this->assertLessThan( $backup_submenu_position, $videopress_submenu_position, 'Jetpack VideoPress should be above Jetpack VaultPress Backup in the submenu order.' );
9486
$this->assertLessThan( $search_submenu_position, $backup_submenu_position, 'Jetpack VaultPress Backup should be above Search in the submenu order.' );
9587
$this->assertLessThan( $settings_submenu_position, $search_submenu_position, 'Search should be above Settings in the submenu order.' );

0 commit comments

Comments
 (0)