Skip to content

Commit 9fedad7

Browse files
update readme.md for 1.7.4
1 parent 66110f9 commit 9fedad7

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

readme.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Nav Menu Roles #
22

33
**Contributors:** helgatheviking
4-
**Donate link:** http://paypal.me/helgatheviking
4+
**Donate link:** https://www.paypal.me/helgatheviking
55
**Tags:** menu, menus, nav menu, nav menus
6-
**Requires at least:** 3.8
7-
**Tested up to:** 4.2
8-
**Stable tag: 1.7.4
6+
**Requires at least:** 3.8.0
7+
**Tested up to:** 4.4.0
8+
**Stable tag:** 1.7.4
99
**License:** GPLv3
1010

11-
Hide custom menu items based on user roles. PLEASE READ THE [FAQ](#conflict) IF YOU ARE NOT SEEING THE SETTINGS.
11+
Hide custom menu items based on user roles. PLEASE READ THE FAQ IF YOU ARE NOT SEEING THE SETTINGS.
1212

1313
## Description ##
1414

@@ -31,7 +31,7 @@ In WordPress menu items and pages are completely separate entities. Nav Menu Rol
3131

3232
Support is handled in the [WordPress forums](https://wordpress.org/support/plugin/nav-menu-roles). Please note that support is limited and does not cover any custom implementation of the plugin. Before posting, please read the [FAQ](http://wordpress.org/plugins/nav-menu-roles/faq/). Also, please verify the problem with other plugins disabled and while using a default theme.
3333

34-
Please report any bugs, errors, warnings, code problems to [Github](https://github.com/helgatheviking/Nav-Menu-Roles/issues)
34+
Please report any bugs, errors, warnings, code problems to [Github](https://github.com/helgatheviking/nav-menu-roles/issues)
3535

3636
## Installation ##
3737

@@ -44,11 +44,12 @@ Please report any bugs, errors, warnings, code problems to [Github](https://gith
4444
## Screenshots ##
4545

4646
### 1. Show the new options for the menu items in the admin menu customizer ###
47-
![Show the new options for the menu items in the admin menu customizer](http://tinyurl.com/qg7bd4c)
47+
![Show the new options for the menu items in the admin menu customizer](http://plugins.svn.wordpress.org/nav-menu-roles/assets/screenshot-1.png)
48+
4849

4950
## Frequently Asked Questions ##
5051

51-
### <a id="conflict"></a>I don't see the Nav Menu Roles options in the admin menu items? ###
52+
= <a id="conflict"></a>I don't see the Nav Menu Roles options in the admin menu items? =
5253

5354
This is because you have another plugin (or theme) that is also trying to alter the same code that creates the Menu section in the admin.
5455

@@ -65,55 +66,51 @@ WordPress does not have sufficient hooks in this area of the admin and until the
6566
7. Jupiter Theme
6667

6768

68-
### <a id="compatibility"></a>Workaround #1 ###
69+
= <a id="compatibility"></a>Workaround #1 =
6970
[Shazdeh](https://profiles.wordpress.org/shazdeh/) had the genius idea to not wait for a core hook and simply add the hook ourselves. If all plugin and theme authors use the same hook, we can make our plugins play together.
7071

7172
Therefore, as of version 1.6 I am modifying my admin nav menu Walker to *only* adding the following lines (right after the description input):
7273

73-
```
74+
`
7475
<?php
7576
// Place this in your admin nav menu Walker
7677
do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args );
7778
// end added section
7879
?>
79-
```
80+
`
8081

8182
**Ask your conflicting plugin/theme's author to add this code to his plugin or theme and our plugins will become compatible.**
8283

83-
### <a id="patch"></a>Patching Your Plugin/Theme ###
84+
= <a id="patch"></a>Patching Your Plugin/Theme =
8485

8586
**Should you wish to attempt this patch yourself, you can modify your conflicting plugin/theme's admin menu Walker class. **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!**
8687

8788
1. Find the class that extends the `Walker_Nav_Menu`. As a hint, it is filtering `wp_edit_nav_menu_walker` and you might even be getting a warning about it from Nav Menu Roles. Example:
8889

89-
```
90+
`
9091
add_filter( 'wp_edit_nav_menu_walker', 'sample_edit_nav_menu_walker');
9192
function sample_edit_nav_menu_walker( $walker ) {
9293
return 'Walker_Nav_Menu_Edit_Roles'; // this is the class name
9394
}
94-
```
95+
`
9596

9697
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:
9798

98-
```
99-
class Walker_Nav_Menu_Edit_Roles extends Walker_Nav_Menu {}
100-
```
99+
`class Walker_Nav_Menu_Edit_Roles extends Walker_Nav_Menu {}`
101100

102101
Note that the class name is the same as the class name you found in step 1.
103102

104103
3. Find the `start_el()` method
105104

106105
In that file you will eventually see a class method that looks like:
107106

108-
```
109-
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
110-
```
107+
`function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {`
111108

112109
4. Paste my action hook somewhere in this method!
113110

114111
In Nav Menu Roles, I have placed the hook directly after the description, ex:
115112

116-
```
113+
`
117114
<p class="field-description description description-wide">
118115
<label for="edit-menu-item-description-<?php echo $item_id; ?>">
119116
<?php _e( 'Description' ); ?><br />
@@ -127,7 +124,7 @@ In Nav Menu Roles, I have placed the hook directly after the description, ex:
127124
do_action( 'wp_nav_menu_item_custom_fields', $item_id, $item, $depth, $args );
128125
// end added section
129126
?>
130-
```
127+
`
131128

132129
### Workaround #2 ###
133130

@@ -139,9 +136,9 @@ There are apparently a few membership plugins out there that *don't* use traditi
139136

140137
Here's an example where I've added a new pseudo role, creatively called "new-role". The first function adds it to the menu item admin screen. The second function is pretty generic and won't actually do anything because you need to supply your own logic based on the plugin you are using. Nav Menu Roles will save the new "role" info and add it to the item in an array to the `$item->roles` variable.
141138

142-
### <a id="new-role"></a>Adding a new "role" ###
139+
= <a id="new-role"></a>Adding a new "role" =
143140

144-
```
141+
`
145142
/*
146143
* Add custom roles to Nav Menu Roles menu list
147144
** * param:** $roles an array of all available roles, by default is global $wp_roles
@@ -152,13 +149,13 @@ function kia_new_roles( $roles ){
152149
return $roles;
153150
}
154151
add_filter( 'nav_menu_roles', 'kia_new_roles' );
155-
```
152+
`
156153

157154
Note, if you want to add a WordPress capability the above is literally all you need. Because Nav Menu Roles checks whether a role has permission to view the menu item using `current_user_can($role) you do not need to right a custom callback for the `nav_menu_roles_item_visibility` filter.
158155

159156
In case you *do* need to check your visibility status against something very custom, here is how you'd go about it:
160157

161-
```
158+
`
162159
/*
163160
* Change visibilty of each menu item
164161
** * param:** $visible boolean
@@ -177,7 +174,7 @@ function kia_item_visibility( $visible, $item ){
177174
return $visible;
178175
}
179176
add_filter( 'nav_menu_roles_item_visibility', 'kia_item_visibility', 10, 2 );
180-
```
177+
`
181178

182179
Note that you have to generate your own if/then logic. I can't provide free support for custom integration with another plugin. You may [contact me](http://kathyisawesome.com/contact) to discuss hiring me, or I would suggest using a plugin that supports WordPress' roles, such as Justin Tadlock's [Members](http://wordpress.org/plugins/members).
183180

@@ -189,9 +186,9 @@ Therefore, if you have no items to display, WordPress will end up displaying ALL
189186

190187
If you don't want this, you must set the fallback argument to be a null string.
191188

192-
```
189+
`
193190
wp_nav_menu( array( 'theme_location' => 'primary-menu', 'fallback_cb' => '' ) );
194-
```
191+
`
195192

196193
### What happened to my menu roles on import/export? ###
197194

@@ -209,10 +206,14 @@ However, the Import plugin only imports certain post meta for menu items. As of
209206

210207
## Changelog ##
211208

209+
### 1.7.4 ###
210+
* Change language in metabox to try to explain min caps versus strict role checking
211+
* keep tweaking the FAQ
212+
212213
### 1.7.3 ###
213214
* update readme, update error notice, add more links to the FAQ
214215

215-
### 1.7.2###
216+
### 1.7.2 ###
216217
* add Italian language. props @sododesign
217218

218219
### 1.7.1 ###

0 commit comments

Comments
 (0)