Version Description
- Tweak: Alphabetically sort role names.
Download this release
Release Info
Developer | helgatheviking |
Plugin | Nav Menu Roles |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.1
- inc/customizer.php +3 -0
- languages/nav-menu-roles.pot +10 -10
- nav-menu-roles.php +4 -1
- readme.txt +12 -10
inc/customizer.php
CHANGED
@@ -45,6 +45,9 @@ function customizer_custom_fields() {
|
|
45 |
*/
|
46 |
$display_roles = apply_filters( 'nav_menu_roles', $wp_roles->role_names );
|
47 |
|
|
|
|
|
|
|
48 |
if ( ! $display_roles ) {
|
49 |
return;
|
50 |
}
|
45 |
*/
|
46 |
$display_roles = apply_filters( 'nav_menu_roles', $wp_roles->role_names );
|
47 |
|
48 |
+
// Alpha sort roles by label.
|
49 |
+
asort( $display_roles );
|
50 |
+
|
51 |
if ( ! $display_roles ) {
|
52 |
return;
|
53 |
}
|
languages/nav-menu-roles.pot
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the GPL-3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Nav Menu Roles 2.0.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nav-menu-roles\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
@@ -183,23 +183,23 @@ msgstr ""
|
|
183 |
msgid "Edit Menu Item"
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: inc/customizer.php:
|
187 |
msgid "Display Mode"
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: inc/customizer.php:
|
191 |
msgid "Logged In Users"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: inc/customizer.php:
|
195 |
msgid "Logged Out Users"
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: inc/customizer.php:
|
199 |
msgid "Everyone"
|
200 |
msgstr ""
|
201 |
|
202 |
-
#: inc/customizer.php:
|
203 |
msgid "Restrict menu item to minimum role"
|
204 |
msgstr ""
|
205 |
|
@@ -229,7 +229,7 @@ msgstr ""
|
|
229 |
msgid "Donate"
|
230 |
msgstr ""
|
231 |
|
232 |
-
#: nav-menu-roles.php:
|
233 |
msgid "Restrict menu item to a minimum role"
|
234 |
msgstr ""
|
235 |
|
1 |
+
# Copyright (C) 2021 Kathy Darling
|
2 |
# This file is distributed under the GPL-3.0.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Nav Menu Roles 2.0.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nav-menu-roles\n"
|
7 |
+
"POT-Creation-Date: 2021-03-18 01:56:18+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
183 |
msgid "Edit Menu Item"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: inc/customizer.php:57 nav-menu-roles.php:371
|
187 |
msgid "Display Mode"
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: inc/customizer.php:61 nav-menu-roles.php:377
|
191 |
msgid "Logged In Users"
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: inc/customizer.php:65 nav-menu-roles.php:382
|
195 |
msgid "Logged Out Users"
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: inc/customizer.php:69 nav-menu-roles.php:387
|
199 |
msgid "Everyone"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: inc/customizer.php:74
|
203 |
msgid "Restrict menu item to minimum role"
|
204 |
msgstr ""
|
205 |
|
229 |
msgid "Donate"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: nav-menu-roles.php:393
|
233 |
msgid "Restrict menu item to a minimum role"
|
234 |
msgstr ""
|
235 |
|
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: 2.0.
|
7 |
* Author: Kathy Darling
|
8 |
* Author URI: http://www.kathyisawesome.com
|
9 |
* License: GPL-3.0
|
@@ -326,6 +326,9 @@ class Nav_Menu_Roles {
|
|
326 |
*/
|
327 |
$display_roles = apply_filters( 'nav_menu_roles', $wp_roles->role_names, $item );
|
328 |
|
|
|
|
|
|
|
329 |
/**
|
330 |
* If no roles are being used, don't display the role selection radio buttons at all.
|
331 |
* Unless something deliberately removes the WordPress roles from this list, nothing will
|
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: 2.0.1
|
7 |
* Author: Kathy Darling
|
8 |
* Author URI: http://www.kathyisawesome.com
|
9 |
* License: GPL-3.0
|
326 |
*/
|
327 |
$display_roles = apply_filters( 'nav_menu_roles', $wp_roles->role_names, $item );
|
328 |
|
329 |
+
// Alpha sort roles by label.
|
330 |
+
asort( $wp_roles->role_names );
|
331 |
+
|
332 |
/**
|
333 |
* If no roles are being used, don't display the role selection radio buttons at all.
|
334 |
* Unless something deliberately removes the WordPress roles from this list, nothing will
|
readme.txt
CHANGED
@@ -4,9 +4,9 @@ Contributors: helgatheviking
|
|
4 |
Donate link: https://www.paypal.com/fundraiser/charity/1451316
|
5 |
Tags: menu, menus, nav menu, nav menus
|
6 |
Requires at least: 4.5.0
|
7 |
-
Tested up to: 5.
|
8 |
Requires PHP: 5.3.2
|
9 |
-
Stable tag: 2.0.
|
10 |
License: GPLv3
|
11 |
|
12 |
Hide custom menu items based on user roles. PLEASE READ THE FAQ IF YOU ARE NOT SEEING THE SETTINGS.
|
@@ -144,6 +144,13 @@ There are apparently a few membership plugins out there that *don't* use traditi
|
|
144 |
|
145 |
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.
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
= Adding a new "role" =
|
148 |
|
149 |
The roles in NMR are filterable distinct from the global `$wp_roles`. This allows for compatibility to be added between plugins that don't use the core roles to determine access, like some membership plugins.
|
@@ -188,14 +195,6 @@ add_filter( 'nav_menu_roles_item_visibility', 'kia_item_visibility', 10, 2 );
|
|
188 |
|
189 |
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).
|
190 |
|
191 |
-
|
192 |
-
= Existing Compatibility Plugins =
|
193 |
-
|
194 |
-
1. [Wishlists Memberships](https://github.com/helgatheviking/nav-menu-roles-wishlists-memberships)
|
195 |
-
2. [WooCommerce Memberships](https://github.com/helgatheviking/nav-menu-roles-woocommerce-memberships)
|
196 |
-
|
197 |
-
If your membership plugin is not listed here, you may be able to use the above bridge plugins as a template. Scroll down to the bottom of the main plugin file and you will see a section for "Helper Functions". If you modify the 3 wrapper functions according to your membership plugin's logic, the rest of the plugin should handle the integration with Nav Menu Roles.
|
198 |
-
|
199 |
= Sort the roles alphabetically =
|
200 |
|
201 |
Add the following snippet to your theme's `functions.php` file:
|
@@ -248,6 +247,9 @@ Yes, but manually. WPML developers have informed me that the meta data for nav m
|
|
248 |
|
249 |
== Changelog ==
|
250 |
|
|
|
|
|
|
|
251 |
= 2.0.0 =
|
252 |
* New: Customizer support! props @westonruter!
|
253 |
|
4 |
Donate link: https://www.paypal.com/fundraiser/charity/1451316
|
5 |
Tags: menu, menus, nav menu, nav menus
|
6 |
Requires at least: 4.5.0
|
7 |
+
Tested up to: 5.7.0
|
8 |
Requires PHP: 5.3.2
|
9 |
+
Stable tag: 2.0.1
|
10 |
License: GPLv3
|
11 |
|
12 |
Hide custom menu items based on user roles. PLEASE READ THE FAQ IF YOU ARE NOT SEEING THE SETTINGS.
|
144 |
|
145 |
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.
|
146 |
|
147 |
+
= Existing Compatibility Plugins =
|
148 |
+
|
149 |
+
1. [Wishlists Memberships](https://github.com/helgatheviking/nav-menu-roles-wishlists-memberships)
|
150 |
+
2. [WooCommerce Memberships](https://github.com/helgatheviking/nav-menu-roles-woocommerce-memberships)
|
151 |
+
|
152 |
+
If your membership plugin is not listed here, you may be able to use the above bridge plugins as a template. Scroll down to the bottom of the main plugin file and you will see a section for "Helper Functions". If you modify the 3 wrapper functions according to your membership plugin's logic, the rest of the plugin should handle the integration with Nav Menu Roles.
|
153 |
+
|
154 |
= Adding a new "role" =
|
155 |
|
156 |
The roles in NMR are filterable distinct from the global `$wp_roles`. This allows for compatibility to be added between plugins that don't use the core roles to determine access, like some membership plugins.
|
195 |
|
196 |
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).
|
197 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
= Sort the roles alphabetically =
|
199 |
|
200 |
Add the following snippet to your theme's `functions.php` file:
|
247 |
|
248 |
== Changelog ==
|
249 |
|
250 |
+
= 2.0.1 =
|
251 |
+
* Tweak: Alphabetically sort role names.
|
252 |
+
|
253 |
= 2.0.0 =
|
254 |
* New: Customizer support! props @westonruter!
|
255 |
|