Admin Menu Editor - Version 1.9

Version Description

  • Added an option to automatically hide new plugins. It was already possible, but previously this option was tied to the "show all plugins" checkbox. Now there is a separate "New plugins" checkbox.
  • Fixed a bug where trying to change the icon of the Jetpack menu caused a JavaScript error that prevented the icon selector from being displayed.
  • Tested up to WP 5.2.
Download this release

Release Info

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

Code changes from version 1.8.8 to 1.9

js/menu-editor.js CHANGED
@@ -2861,7 +2861,9 @@ function ameOnDomReady() {
2861
}
2862
2863
//Activate the tab that contains the icon.
2864
- var activeTabId = selectedIcon.closest('.ws_tool_tab').prop('id'),
2865
activeTabItem = iconSelectorTabs.find('a[href="#' + activeTabId + '"]').closest('li');
2866
if (activeTabItem.length > 0) {
2867
iconSelectorTabs.tabs('option', 'active', activeTabItem.index());
2861
}
2862
2863
//Activate the tab that contains the icon.
2864
+ var activeTabId = ((selectedIcon !== null)
2865
+ ? selectedIcon.closest('.ws_tool_tab').prop('id')
2866
+ : 'ws_core_icons_tab'),
2867
activeTabItem = iconSelectorTabs.find('a[href="#' + activeTabId + '"]').closest('li');
2868
if (activeTabItem.length > 0) {
2869
iconSelectorTabs.tabs('option', 'active', activeTabItem.index());
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.8.8
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
7
Author: Janis Elsts
8
Author URI: http://w-shadow.com/blog/
9
*/
modules/plugin-visibility/plugin-visibility-template.php CHANGED
@@ -72,7 +72,8 @@
72
73
<td><p data-bind="text: description"></p></td>
74
</tr>
75
- <tr class="inline-edit-row" data-bind="if: isBeingEdited">
76
<td class="colspanchange" colspan="3">
77
<fieldset class="ame-pv-inline-edit-left">
78
<legend class="inline-edit-legend" data-bind="text: defaultProperties['name']">
@@ -151,6 +152,30 @@
151
</tbody>
152
153
<tfoot>
154
<tr>
155
<th scope="col" class="ame-check-column">
156
<!--suppress HtmlFormInputWithoutLabel -->
72
73
<td><p data-bind="text: description"></p></td>
74
</tr>
75
+ <tr class="inline-edit-row" data-bind="if: isBeingEdited, visible: true"
76
+ style="display: none;">
77
<td class="colspanchange" colspan="3">
78
<fieldset class="ame-pv-inline-edit-left">
79
<legend class="inline-edit-legend" data-bind="text: defaultProperties['name']">
152
</tbody>
153
154
<tfoot>
155
+ <tr class="inactive ame-pv-new-plugin-visibility-row">
156
+ <th scope="row" class="ame-check-column">
157
+ <input
158
+ type="checkbox"
159
+ data-bind="checked: areNewPluginsVisible"
160
+ id="ame-pv-new-plugin-visibility">
161
+ </th>
162
+ <td class="plugin-title">
163
+ <label for="ame-pv-new-plugin-visibility">
164
+ <strong>[New Plugins]</strong>
165
+ </label>
166
+ </td>
167
+ <td>
168
+ <p>
169
+ This setting controls whether the selected role will be able
170
+ to see newly installed plugins.
171
+ </p>
172
+ <ul>
173
+ <li>Checked: New plugins will be visible by default.</li>
174
+ <li>Unchecked: New plugins will be automatically hidden.</li>
175
+ </ul>
176
+ </td>
177
+ </tr>
178
+
179
<tr>
180
<th scope="col" class="ame-check-column">
181
<!--suppress HtmlFormInputWithoutLabel -->
modules/plugin-visibility/plugin-visibility.css CHANGED
@@ -67,4 +67,20 @@
67
line-height: 2.5;
68
font-weight: 600; }
69
70
/*# sourceMappingURL=plugin-visibility.css.map */
67
line-height: 2.5;
68
font-weight: 600; }
69
70
+ /*
71
+ The "New Plugins" option is displayed in the table footer.
72
+ It needs to override some default footer styles.
73
+ */
74
+ .plugins tfoot .ame-pv-new-plugin-visibility-row th.ame-check-column {
75
+ padding-top: 8px;
76
+ vertical-align: top; }
77
+ .plugins tfoot .ame-pv-new-plugin-visibility-row th.ame-check-column input[type=checkbox] {
78
+ margin-top: 4px; }
79
+ .plugins tfoot .ame-pv-new-plugin-visibility-row ul {
80
+ list-style: inside disc;
81
+ margin-left: 1em;
82
+ margin-top: 0.8em; }
83
+ .plugins tfoot .ame-pv-new-plugin-visibility-row th, .plugins tfoot .ame-pv-new-plugin-visibility-row td {
84
+ border-top: none; }
85
+
86
/*# sourceMappingURL=plugin-visibility.css.map */
modules/plugin-visibility/plugin-visibility.js CHANGED
@@ -41,17 +41,50 @@ var AmePluginVisibilityModule = /** @class */ (function () {
41
if (this.isMultisite) {
42
this.privilegedActors.push(AmeActors.getSuperAdmin());
43
}
44
- this.areAllPluginsChecked = ko.computed({
45
read: function () {
46
- return _.every(_this.plugins, function (plugin) {
47
- return _this.isPluginVisible(plugin);
48
});
49
},
50
write: function (isChecked) {
51
if (_this.selectedActor() !== null) {
52
var canSeePluginsByDefault = _this.getGrantAccessByDefault(_this.selectedActor());
53
canSeePluginsByDefault(isChecked);
54
}
55
_.forEach(_this.plugins, function (plugin) {
56
_this.setPluginVisibility(plugin, isChecked);
57
});
41
if (this.isMultisite) {
42
this.privilegedActors.push(AmeActors.getSuperAdmin());
43
}
44
+ this.areNewPluginsVisible = ko.computed({
45
read: function () {
46
+ if (_this.selectedActor() !== null) {
47
+ var canSeePluginsByDefault = _this.getGrantAccessByDefault(_this.selectedActor());
48
+ return canSeePluginsByDefault();
49
+ }
50
+ return _.every(_this.actorSelector.getVisibleActors(), function (actor) {
51
+ //Only consider roles than can manage plugins.
52
+ if (!_this.canManagePlugins(actor)) {
53
+ return true;
54
+ }
55
+ var canSeePluginsByDefault = _this.getGrantAccessByDefault(actor.getId());
56
+ return canSeePluginsByDefault();
57
});
58
},
59
write: function (isChecked) {
60
if (_this.selectedActor() !== null) {
61
var canSeePluginsByDefault = _this.getGrantAccessByDefault(_this.selectedActor());
62
canSeePluginsByDefault(isChecked);
63
+ return;
64
}
65
+ //Update everyone except the current user and Super Admin.
66
+ _.forEach(_this.actorSelector.getVisibleActors(), function (actor) {
67
+ var isAllowed = _this.getGrantAccessByDefault(actor.getId());
68
+ if (!_this.canManagePlugins(actor)) {
69
+ isAllowed(false);
70
+ }
71
+ else if (_.includes(_this.privilegedActors, actor)) {
72
+ isAllowed(true);
73
+ }
74
+ else {
75
+ isAllowed(isChecked);
76
+ }
77
+ });
78
+ }
79
+ });
80
+ this.areAllPluginsChecked = ko.computed({
81
+ read: function () {
82
+ return _.every(_this.plugins, function (plugin) {
83
+ return _this.isPluginVisible(plugin);
84
+ }) && _this.areNewPluginsVisible();
85
+ },
86
+ write: function (isChecked) {
87
+ _this.areNewPluginsVisible(isChecked);
88
_.forEach(_this.plugins, function (plugin) {
89
_this.setPluginVisibility(plugin, isChecked);
90
});
modules/plugin-visibility/plugin-visibility.scss CHANGED
@@ -60,6 +60,7 @@
60
.ame-pv-inline-edit-left {
61
width: 35%;
62
}
63
.ame-pv-inline-edit-right {
64
width: 65%;
65
}
@@ -67,6 +68,7 @@
67
span.title {
68
width: auto;
69
}
70
input[type="text"] {
71
width: 100%;
72
}
@@ -81,7 +83,7 @@
81
}
82
83
td {
84
- box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1);
85
}
86
87
p.submit {
@@ -95,3 +97,28 @@
95
font-weight: 600;
96
}
97
}
60
.ame-pv-inline-edit-left {
61
width: 35%;
62
}
63
+
64
.ame-pv-inline-edit-right {
65
width: 65%;
66
}
68
span.title {
69
width: auto;
70
}
71
+
72
input[type="text"] {
73
width: 100%;
74
}
83
}
84
85
td {
86
+ box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);
87
}
88
89
p.submit {
97
font-weight: 600;
98
}
99
}
100
+
101
+ /*
102
+ The "New Plugins" option is displayed in the table footer.
103
+ It needs to override some default footer styles.
104
+ */
105
+ .plugins tfoot .ame-pv-new-plugin-visibility-row {
106
+ th.ame-check-column {
107
+ padding-top: 8px;
108
+ vertical-align: top;
109
+
110
+ input[type=checkbox] {
111
+ margin-top: 4px;
112
+ }
113
+ }
114
+
115
+ ul {
116
+ list-style: inside disc;
117
+ margin-left: 1em;
118
+ margin-top: 0.8em;
119
+ }
120
+
121
+ th, td {
122
+ border-top: none;
123
+ }
124
+ }
modules/plugin-visibility/plugin-visibility.ts CHANGED
@@ -60,6 +60,7 @@ class AmePluginVisibilityModule {
60
settingsData: KnockoutObservable<string>;
61
62
areAllPluginsChecked: KnockoutComputed<boolean>;
63
64
/**
65
* Actors that don't lose access to a plugin when you uncheck it in the "All" view.
@@ -112,17 +113,51 @@ class AmePluginVisibilityModule {
112
this.privilegedActors.push(AmeActors.getSuperAdmin());
113
}
114
115
- this.areAllPluginsChecked = ko.computed({
116
read: () => {
117
- return _.every(this.plugins, (plugin) => {
118
- return this.isPluginVisible(plugin);
119
});
120
},
121
write: (isChecked) => {
122
if (this.selectedActor() !== null) {
123
let canSeePluginsByDefault = this.getGrantAccessByDefault(this.selectedActor());
124
canSeePluginsByDefault(isChecked);
125
}
126
_.forEach(this.plugins, (plugin) => {
127
this.setPluginVisibility(plugin, isChecked);
128
});
60
settingsData: KnockoutObservable<string>;
61
62
areAllPluginsChecked: KnockoutComputed<boolean>;
63
+ areNewPluginsVisible: KnockoutComputed<boolean>;
64
65
/**
66
* Actors that don't lose access to a plugin when you uncheck it in the "All" view.
113
this.privilegedActors.push(AmeActors.getSuperAdmin());
114
}
115
116
+ this.areNewPluginsVisible = ko.computed({
117
read: () => {
118
+ if (this.selectedActor() !== null) {
119
+ let canSeePluginsByDefault = this.getGrantAccessByDefault(this.selectedActor());
120
+ return canSeePluginsByDefault();
121
+ }
122
+
123
+ return _.every(this.actorSelector.getVisibleActors(), (actor: AmeBaseActor) => {
124
+ //Only consider roles than can manage plugins.
125
+ if (!this.canManagePlugins(actor)) {
126
+ return true;
127
+ }
128
+ let canSeePluginsByDefault = this.getGrantAccessByDefault(actor.getId());
129
+ return canSeePluginsByDefault();
130
});
131
},
132
write: (isChecked) => {
133
if (this.selectedActor() !== null) {
134
let canSeePluginsByDefault = this.getGrantAccessByDefault(this.selectedActor());
135
canSeePluginsByDefault(isChecked);
136
+ return;
137
}
138
+
139
+ //Update everyone except the current user and Super Admin.
140
+ _.forEach(this.actorSelector.getVisibleActors(), (actor: AmeBaseActor) => {
141
+ let isAllowed = this.getGrantAccessByDefault(actor.getId());
142
+ if (!this.canManagePlugins(actor)) {
143
+ isAllowed(false);
144
+ } else if (_.includes(this.privilegedActors, actor)) {
145
+ isAllowed(true);
146
+ } else {
147
+ isAllowed(isChecked);
148
+ }
149
+ });
150
+ }
151
+ });
152
+
153
+ this.areAllPluginsChecked = ko.computed({
154
+ read: () => {
155
+ return _.every(this.plugins, (plugin) => {
156
+ return this.isPluginVisible(plugin);
157
+ }) && this.areNewPluginsVisible();
158
+ },
159
+ write: (isChecked) => {
160
+ this.areNewPluginsVisible(isChecked);
161
_.forEach(this.plugins, (plugin) => {
162
this.setPluginVisibility(plugin, isChecked);
163
});
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: whiteshadow
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
4
Tags: admin, dashboard, menu, security, wpmu
5
Requires at least: 4.1
6
- Tested up to: 5.1
7
- Stable tag: 1.8.8
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,11 @@ Plugins installed in the `mu-plugins` directory are treated as "always on", so y
63
64
== Changelog ==
65
66
= 1.8.8 =
67
* Added the ability to edit more plugin details like author name, site URL and version number. Note that this feature only changes how plugins are displayed. It doesn't actually modify plugin files.
68
* Fixed a PHP deprecation notice: "strpos(): Non-string needles will be interpreted as strings in the future". Hopefully this time it's been fixed for good.
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=A6P9S6CE3SRSW
4
Tags: admin, dashboard, menu, security, wpmu
5
Requires at least: 4.1
6
+ Tested up to: 5.2
7
+ Stable tag: 1.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
64
== Changelog ==
65
66
+ = 1.9 =
67
+ * Added an option to automatically hide new plugins. It was already possible, but previously this option was tied to the "show all plugins" checkbox. Now there is a separate "New plugins" checkbox.
68
+ * Fixed a bug where trying to change the icon of the Jetpack menu caused a JavaScript error that prevented the icon selector from being displayed.
69
+ * Tested up to WP 5.2.
70
+
71
= 1.8.8 =
72
* Added the ability to edit more plugin details like author name, site URL and version number. Note that this feature only changes how plugins are displayed. It doesn't actually modify plugin files.
73
* Fixed a PHP deprecation notice: "strpos(): Non-string needles will be interpreted as strings in the future". Hopefully this time it's been fixed for good.