Version Description
- revert priority of walker back to default because themes are not actually using the hook to add their own fields. sadface.
Download this release
Release Info
Developer | deployer |
Plugin | Nav Menu Roles |
Version | 1.7.9 |
Comparing to | |
See all releases |
Code changes from version 1.7.8 to 1.7.9
- nav-menu-roles.php +2 -2
- readme.txt +13 -18
nav-menu-roles.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Nav Menu Roles
|
4 |
Plugin URI: http://www.kathyisawesome.com/449/nav-menu-roles/
|
5 |
Description: Hide custom menu items based on user roles.
|
6 |
-
Version: 1.7.
|
7 |
Author: Kathy Darling
|
8 |
Author URI: http://www.kathyisawesome.com
|
9 |
License: GPL2
|
@@ -109,7 +109,7 @@ class Nav_Menu_Roles {
|
|
109 |
add_filter( 'plugin_row_meta', array( $this, 'add_action_links' ), 10, 4 );
|
110 |
|
111 |
// switch the admin walker
|
112 |
-
add_filter( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' )
|
113 |
|
114 |
// add new fields via hook
|
115 |
add_action( 'wp_nav_menu_item_custom_fields', array( $this, 'custom_fields' ), 10, 4 );
|
3 |
Plugin Name: Nav Menu Roles
|
4 |
Plugin URI: http://www.kathyisawesome.com/449/nav-menu-roles/
|
5 |
Description: Hide custom menu items based on user roles.
|
6 |
+
Version: 1.7.9
|
7 |
Author: Kathy Darling
|
8 |
Author URI: http://www.kathyisawesome.com
|
9 |
License: GPL2
|
109 |
add_filter( 'plugin_row_meta', array( $this, 'add_action_links' ), 10, 4 );
|
110 |
|
111 |
// switch the admin walker
|
112 |
+
add_filter( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' ) );
|
113 |
|
114 |
// add new fields via hook
|
115 |
add_action( 'wp_nav_menu_item_custom_fields', array( $this, 'custom_fields' ), 10, 4 );
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: https://www.paypal.me/helgatheviking
|
|
5 |
Tags: menu, menus, nav menu, nav menus
|
6 |
Requires at least: 4.4.0
|
7 |
Tested up to: 4.4.0
|
8 |
-
Stable tag: 1.7.
|
9 |
License: GPLv3
|
10 |
|
11 |
Hide custom menu items based on user roles. PLEASE READ THE FAQ IF YOU ARE NOT SEEING THE SETTINGS.
|
@@ -85,30 +85,22 @@ Should you wish to attempt this patch yourself, you can modify your conflicting
|
|
85 |
|
86 |
**Reminder: I do not provide support for fixing your plugin/theme. If you aren't comfortable with the following instructions, contact the developer of the conflicting plugin/theme!**
|
87 |
|
88 |
-
1
|
89 |
|
90 |
-
`
|
91 |
-
add_filter( 'wp_edit_nav_menu_walker', 'sample_edit_nav_menu_walker');
|
92 |
-
function sample_edit_nav_menu_walker( $walker ) {
|
93 |
-
return 'Walker_Nav_Menu_Edit_Roles'; // this is the class name
|
94 |
-
}
|
95 |
-
`
|
96 |
-
|
97 |
-
2. Find the file for the extending class. In my plugin this is in a file located at `inc/class.Walker_Nav_Menu_Edit_Roles.php`. I can't know *where* this file is in your plugin/theme. Please don't ask me, but here's what the beginning of that class will look like:
|
98 |
-
|
99 |
-
`class Walker_Nav_Menu_Edit_Roles extends Walker_Nav_Menu {}`
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
3. Find the `start_el()` method
|
104 |
|
105 |
In that file you will eventually see a class method that looks like:
|
106 |
|
107 |
-
`function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
|
|
|
|
|
|
108 |
|
109 |
-
|
110 |
|
111 |
-
In Nav Menu Roles, I have placed the hook directly after the description,
|
112 |
|
113 |
`
|
114 |
<p class="field-description description description-wide">
|
@@ -206,6 +198,9 @@ However, the Import plugin only imports certain post meta for menu items. As of
|
|
206 |
|
207 |
== Changelog ==
|
208 |
|
|
|
|
|
|
|
209 |
= 1.7.8 =
|
210 |
* remove all admin notices
|
211 |
|
5 |
Tags: menu, menus, nav menu, nav menus
|
6 |
Requires at least: 4.4.0
|
7 |
Tested up to: 4.4.0
|
8 |
+
Stable tag: 1.7.9
|
9 |
License: GPLv3
|
10 |
|
11 |
Hide custom menu items based on user roles. PLEASE READ THE FAQ IF YOU ARE NOT SEEING THE SETTINGS.
|
85 |
|
86 |
**Reminder: I do not provide support for fixing your plugin/theme. If you aren't comfortable with the following instructions, contact the developer of the conflicting plugin/theme!**
|
87 |
|
88 |
+
1\. Find the class that extends the `Walker_Nav_Menu`. The fastest way to do this is to search your whole plugin/theme folder for `extends Walker_Nav_Menu`. When you find the file that contains this text you willl know which file you need to edit. Once you find it here's what the beginning of that class will look like:
|
89 |
|
90 |
+
`class YOUR_THEME_CUSTOM_WALKER extends Walker_Nav_Menu {}`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
+
2\. Find the `start_el()` method
|
|
|
|
|
93 |
|
94 |
In that file you will eventually see a class method that looks like:
|
95 |
|
96 |
+
`function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
|
97 |
+
// some stuff truncated for brevity
|
98 |
+
}
|
99 |
+
`
|
100 |
|
101 |
+
3\. Paste my action hook somewhere in this method!
|
102 |
|
103 |
+
In Nav Menu Roles, I have placed the hook directly after the description, like so:
|
104 |
|
105 |
`
|
106 |
<p class="field-description description description-wide">
|
198 |
|
199 |
== Changelog ==
|
200 |
|
201 |
+
= 1.7.9 =
|
202 |
+
* revert priority of walker back to default because themes are not actually using the hook to add their own fields. sadface.
|
203 |
+
|
204 |
= 1.7.8 =
|
205 |
* remove all admin notices
|
206 |
|