Admin Menu Editor - Version 1.9.10

Version Description

  • Fixed a bug where the plugin could incorrectly identify a separator as the current menu item.
  • Fixed submenu box not expanding to align with the selected parent item.
  • Fixed a PHP 5 compatibility issue where the "Prevent bbPress from resetting role capabilities" would trigger notices and not work correctly. This bug did not affect newer PHP versions such as PHP 7.
  • Fixed a couple of icon and separator rendering bugs where the hover marker - that is, the colored vertical bar that appears next to the currently hovered menu item, introduced in WP 5.7 - could either show up in the wrong place or show up when it's not supposed to.
  • Fixed a jQuery Migrate warning about isFunction() being deprecated.
Download this release

Release Info

Developer whiteshadow
Plugin Icon 128x128 Admin Menu Editor
Version 1.9.10
Comparing to
See all releases

Code changes from version 1.9.9 to 1.9.10

css/admin.css CHANGED
@@ -50,6 +50,11 @@ hr.ws-submenu-separator {
50
  cursor: default;
51
  }
52
 
 
 
 
 
 
53
  /* No extra margin in submenus with icons. The selector uses the URL prefix because we can't control the link class.
54
  * li.ws-submenu-separator-wrap would also work, but it's added via JS so there's an undesirable delay (FOUC).
55
  */
@@ -73,7 +78,7 @@ hr.ws-submenu-separator {
73
  * Submenu icons.
74
  */
75
  .ame-submenu-icon {
76
- display: inline-block;
77
  padding-right: 8px;
78
  min-width: 20px;
79
 
@@ -83,8 +88,8 @@ hr.ws-submenu-separator {
83
  it looks okay - submenu items are ~28px high when including padding/margins, so there's no visual overlap.
84
  */
85
  height: 20px;
86
- margin-top: -2px;
87
- margin-bottom: -2px;
88
 
89
  vertical-align: top;
90
 
@@ -97,7 +102,7 @@ hr.ws-submenu-separator {
97
 
98
  #adminmenu .ame-has-submenu-icons ul.wp-submenu li a {
99
  /* Push all submenus to the right to ensure that items with and without icons line up nicely. */
100
- margin-left: 24px;
101
  }
102
 
103
  #adminmenu .ame-submenu-icon img {
50
  cursor: default;
51
  }
52
 
53
+ /* No colored bar/marker when hovering over a separator. */
54
+ #adminmenu li.ws-submenu-separator-wrap a:hover {
55
+ box-shadow: none;
56
+ }
57
+
58
  /* No extra margin in submenus with icons. The selector uses the URL prefix because we can't control the link class.
59
  * li.ws-submenu-separator-wrap would also work, but it's added via JS so there's an undesirable delay (FOUC).
60
  */
78
  * Submenu icons.
79
  */
80
  .ame-submenu-icon {
81
+ display: block;
82
  padding-right: 8px;
83
  min-width: 20px;
84
 
88
  it looks okay - submenu items are ~28px high when including padding/margins, so there's no visual overlap.
89
  */
90
  height: 20px;
91
+ margin-top: -1px;
92
+ margin-bottom: -3px;
93
 
94
  vertical-align: top;
95
 
102
 
103
  #adminmenu .ame-has-submenu-icons ul.wp-submenu li a {
104
  /* Push all submenus to the right to ensure that items with and without icons line up nicely. */
105
+ padding-left: 36px;
106
  }
107
 
108
  #adminmenu .ame-submenu-icon img {
includes/bbpress-role-override.php CHANGED
@@ -25,8 +25,8 @@ class ameBBPressRoleOverride {
25
  foreach (array_keys($bbPressRoles) as $id) {
26
  $settings = array();
27
  foreach ($this->propertiesToSave as $property) {
28
- if ( isset($wp_roles->$property[$id]) ) {
29
- $settings[$property] = $wp_roles->$property[$id];
30
  }
31
  }
32
  if ( !empty($settings) ) {
@@ -47,7 +47,7 @@ class ameBBPressRoleOverride {
47
  }
48
  foreach ($this->customRoleSettings as $id => $properties) {
49
  foreach ($properties as $property => $value) {
50
- $wp_roles->$property[$id] = $value;
51
  }
52
  }
53
  $this->customRoleSettings = array();
25
  foreach (array_keys($bbPressRoles) as $id) {
26
  $settings = array();
27
  foreach ($this->propertiesToSave as $property) {
28
+ if ( isset($wp_roles->{$property}[$id]) ) {
29
+ $settings[$property] = $wp_roles->{$property}[$id];
30
  }
31
  }
32
  if ( !empty($settings) ) {
47
  }
48
  foreach ($this->customRoleSettings as $id => $properties) {
49
  foreach ($properties as $property => $value) {
50
+ $wp_roles->{$property}[$id] = $value;
51
  }
52
  }
53
  $this->customRoleSettings = array();
includes/menu-editor-core.php CHANGED
@@ -2003,7 +2003,9 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2003
  }
2004
 
2005
  if ( !isset($this->reverse_item_lookup[$topmenu['url']]) ) { //Prefer sub-menus.
2006
- $this->reverse_item_lookup[$topmenu['url']] = $topmenu;
 
 
2007
  }
2008
 
2009
  $has_submenu_icons = false;
@@ -2027,7 +2029,9 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2027
  }
2028
  }
2029
 
2030
- $this->reverse_item_lookup[$item['url']] = $item;
 
 
2031
 
2032
  //Skip missing and hidden items
2033
  if ( !empty($item['missing']) || !empty($item['hidden']) ) {
@@ -2127,6 +2131,10 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2127
  if ( strpos($cssClass, ameMenuItem::unclickableTemplateClass) === false ) {
2128
  $item['css_class'] = ameMenuItem::unclickableTemplateClass . ' ' . $cssClass;
2129
  }
 
 
 
 
2130
  }
2131
 
2132
  //Make the default submenu icon the same as the parent icon.
@@ -2384,6 +2392,17 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
2384
  return $item;
2385
  }
2386
 
 
 
 
 
 
 
 
 
 
 
 
2387
  /**
2388
  * Output the menu editor page
2389
  *
@@ -3733,7 +3752,7 @@ class WPMenuEditor extends MenuEd_ShadowPluginFramework {
3733
  'ame-helper-style',
3734
  plugins_url('css/admin.css', $this->plugin_file),
3735
  array(),
3736
- '20210218'
3737
  );
3738
 
3739
  if ( $this->options['force_custom_dashicons'] ) {
2003
  }
2004
 
2005
  if ( !isset($this->reverse_item_lookup[$topmenu['url']]) ) { //Prefer sub-menus.
2006
+ if ( $this->is_item_visitable($topmenu) ) {
2007
+ $this->reverse_item_lookup[$topmenu['url']] = $topmenu;
2008
+ }
2009
  }
2010
 
2011
  $has_submenu_icons = false;
2029
  }
2030
  }
2031
 
2032
+ if ( $this->is_item_visitable($item) ) {
2033
+ $this->reverse_item_lookup[$item['url']] = $item;
2034
+ }
2035
 
2036
  //Skip missing and hidden items
2037
  if ( !empty($item['missing']) || !empty($item['hidden']) ) {
2131
  if ( strpos($cssClass, ameMenuItem::unclickableTemplateClass) === false ) {
2132
  $item['css_class'] = ameMenuItem::unclickableTemplateClass . ' ' . $cssClass;
2133
  }
2134
+
2135
+ //Mark unclickable items as not visitable. The submenus (if any) can be visited,
2136
+ //but the item itself doesn't link to anything.
2137
+ $item['is_unvisitable'] = true;
2138
  }
2139
 
2140
  //Make the default submenu icon the same as the parent icon.
2392
  return $item;
2393
  }
2394
 
2395
+ /**
2396
+ * Check if a menu item can be visited/navigated to.
2397
+ * Most regular items can be visited. Separators and some special item types cannot.
2398
+ *
2399
+ * @param array $item
2400
+ * @return bool
2401
+ */
2402
+ private function is_item_visitable($item) {
2403
+ return empty($item['separator']) && empty($item['is_unvisitable']);
2404
+ }
2405
+
2406
  /**
2407
  * Output the menu editor page
2408
  *
3752
  'ame-helper-style',
3753
  plugins_url('css/admin.css', $this->plugin_file),
3754
  array(),
3755
+ '20210413'
3756
  );
3757
 
3758
  if ( $this->options['force_custom_dashicons'] ) {
js/jquery.biscuit.js CHANGED
@@ -51,13 +51,13 @@
51
 
52
  function read(s, converter) {
53
  var value = config.raw ? s : parseCookieValue(s);
54
- return $.isFunction(converter) ? converter(value) : value;
55
  }
56
 
57
  var config = $.cookie = function (key, value, options) {
58
 
59
  // Write
60
- if (value !== undefined && !$.isFunction(value)) {
61
  options = $.extend({}, config.defaults, options);
62
 
63
  if (typeof options.expires === 'number') {
51
 
52
  function read(s, converter) {
53
  var value = config.raw ? s : parseCookieValue(s);
54
+ return (typeof converter === 'function') ? converter(value) : value;
55
  }
56
 
57
  var config = $.cookie = function (key, value, options) {
58
 
59
  // Write
60
+ if (value !== undefined && !(typeof value === 'function')) {
61
  options = $.extend({}, config.defaults, options);
62
 
63
  if (typeof options.expires === 'number') {
js/menu-editor.js CHANGED
@@ -620,13 +620,9 @@ var knownMenuFields = {
620
  caption: 'Embedded page ID',
621
  defaultValue: 'Select page to display',
622
  type: 'text',
623
- visible: false, //Displayed on-demand.
624
  addDropdown: 'ws_embedded_page_selector',
625
 
626
  display: function(menuItem, displayValue, input) {
627
- //Only show this field if the "Embed WP page" template is selected.
628
- input.closest('.ws_edit_field').toggle(menuItem.template_id === wsEditorData.embeddedPageTemplateId);
629
-
630
  input.prop('readonly', true);
631
  var pageId = parseInt(getFieldValue(menuItem, 'embedded_page_id', 0), 10),
632
  blogId = parseInt(getFieldValue(menuItem, 'embedded_page_blog_id', 1), 10),
@@ -659,6 +655,11 @@ var knownMenuFields = {
659
 
660
  write: function() {
661
  //The user cannot directly edit this field. We deliberately ignore writes.
 
 
 
 
 
662
  }
663
  }),
664
 
@@ -2137,7 +2138,7 @@ function ameOnDomReady() {
2137
  verticalBoxOffset = (submenuBox.offset().top - mainMenuBox.offset().top),
2138
  minSubmenuHeight = (selectedMenu.offset().top - mainMenuBox.offset().top)
2139
  - verticalBoxOffset
2140
- + menuTipHeight - submenuDropZone.outerHeight() + empiricalExtraHeight;
2141
  minSubmenuHeight = Math.max(minSubmenuHeight, 0);
2142
  submenuBox.css('min-height', minSubmenuHeight);
2143
  }
620
  caption: 'Embedded page ID',
621
  defaultValue: 'Select page to display',
622
  type: 'text',
 
623
  addDropdown: 'ws_embedded_page_selector',
624
 
625
  display: function(menuItem, displayValue, input) {
 
 
 
626
  input.prop('readonly', true);
627
  var pageId = parseInt(getFieldValue(menuItem, 'embedded_page_id', 0), 10),
628
  blogId = parseInt(getFieldValue(menuItem, 'embedded_page_blog_id', 1), 10),
655
 
656
  write: function() {
657
  //The user cannot directly edit this field. We deliberately ignore writes.
658
+ },
659
+
660
+ visible: function(menuItem) {
661
+ //Only show this field if the "Embed WP page" template is selected.
662
+ return (menuItem.template_id === wsEditorData.embeddedPageTemplateId);
663
  }
664
  }),
665
 
2138
  verticalBoxOffset = (submenuBox.offset().top - mainMenuBox.offset().top),
2139
  minSubmenuHeight = (selectedMenu.offset().top - mainMenuBox.offset().top)
2140
  - verticalBoxOffset
2141
+ + menuTipHeight - (submenuDropZone.outerHeight() || 0) + empiricalExtraHeight;
2142
  minSubmenuHeight = Math.max(minSubmenuHeight, 0);
2143
  submenuBox.css('min-height', minSubmenuHeight);
2144
  }
menu-editor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Admin Menu Editor
4
  Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
  Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
- Version: 1.9.9
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
3
  Plugin Name: Admin Menu Editor
4
  Plugin URI: http://w-shadow.com/blog/2008/12/20/admin-menu-editor-for-wordpress/
5
  Description: Lets you directly edit the WordPress admin menu. You can re-order, hide or rename existing menus, add custom menus and more.
6
+ Version: 1.9.10
7
  Author: Janis Elsts
8
  Author URI: http://w-shadow.com/blog/
9
  */
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: admin, dashboard, menu, security, wpmu
5
  Requires at least: 4.1
6
  Tested up to: 5.7
7
- Stable tag: 1.9.9
8
 
9
  Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
 
@@ -63,6 +63,13 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
66
  = 1.9.9 =
67
  * Fixed a conflict with the "PRO Theme" plugin where "PRO Theme" would expand the wrong top level admin menu if the current submenu item had been moved from one parent menu to another.
68
  * Fixed PHP notice "Undefined offset: 0 in /wp-includes/capabilities.php on line 70" (various line numbers).
4
  Tags: admin, dashboard, menu, security, wpmu
5
  Requires at least: 4.1
6
  Tested up to: 5.7
7
+ Stable tag: 1.9.10
8
 
9
  Lets you edit the WordPress admin menu. You can re-order, hide or rename menus, add custom menus and more.
10
 
63
 
64
  == Changelog ==
65
 
66
+ = 1.9.10 =
67
+ * Fixed a bug where the plugin could incorrectly identify a separator as the current menu item.
68
+ * Fixed submenu box not expanding to align with the selected parent item.
69
+ * Fixed a PHP 5 compatibility issue where the "Prevent bbPress from resetting role capabilities" would trigger notices and not work correctly. This bug did not affect newer PHP versions such as PHP 7.
70
+ * Fixed a couple of icon and separator rendering bugs where the hover marker - that is, the colored vertical bar that appears next to the currently hovered menu item, introduced in WP 5.7 - could either show up in the wrong place or show up when it's not supposed to.
71
+ * Fixed a jQuery Migrate warning about isFunction() being deprecated.
72
+
73
  = 1.9.9 =
74
  * Fixed a conflict with the "PRO Theme" plugin where "PRO Theme" would expand the wrong top level admin menu if the current submenu item had been moved from one parent menu to another.
75
  * Fixed PHP notice "Undefined offset: 0 in /wp-includes/capabilities.php on line 70" (various line numbers).