Changeset 3492100
- Timestamp:
- 03/26/2026 07:22:34 PM (40 hours ago)
- Location:
- nav-menu-roles
- Files:
-
- 14 added
- 2 deleted
- 14 edited
- 1 copied
-
tags/2.1.3 (copied) (copied from nav-menu-roles/trunk)
-
tags/2.1.3/assets (added)
-
tags/2.1.3/assets/js (added)
-
tags/2.1.3/assets/js/customizer (added)
-
tags/2.1.3/assets/js/customizer/controls.asset.php (added)
-
tags/2.1.3/assets/js/customizer/controls.js (added)
-
tags/2.1.3/assets/js/nav-menu-roles.asset.php (added)
-
tags/2.1.3/assets/js/nav-menu-roles.js (added)
-
tags/2.1.3/dist (deleted)
-
tags/2.1.3/inc/class-nav-menu-roles-import.php (modified) (1 diff)
-
tags/2.1.3/inc/class-nav-menu-roles.php (modified) (13 diffs)
-
tags/2.1.3/inc/class-walker-nav-menu-edit-roles-4.7.php (modified) (1 diff)
-
tags/2.1.3/inc/customizer.php (modified) (2 diffs)
-
tags/2.1.3/languages/nav-menu-roles.pot (modified) (7 diffs)
-
tags/2.1.3/nav-menu-roles.php (modified) (2 diffs)
-
tags/2.1.3/readme.txt (modified) (5 diffs)
-
trunk/assets (added)
-
trunk/assets/js (added)
-
trunk/assets/js/customizer (added)
-
trunk/assets/js/customizer/controls.asset.php (added)
-
trunk/assets/js/customizer/controls.js (added)
-
trunk/assets/js/nav-menu-roles.asset.php (added)
-
trunk/assets/js/nav-menu-roles.js (added)
-
trunk/dist (deleted)
-
trunk/inc/class-nav-menu-roles-import.php (modified) (1 diff)
-
trunk/inc/class-nav-menu-roles.php (modified) (13 diffs)
-
trunk/inc/class-walker-nav-menu-edit-roles-4.7.php (modified) (1 diff)
-
trunk/inc/customizer.php (modified) (2 diffs)
-
trunk/languages/nav-menu-roles.pot (modified) (7 diffs)
-
trunk/nav-menu-roles.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
nav-menu-roles/tags/2.1.3/inc/class-nav-menu-roles-import.php
r2844987 r3492100 53 53 * __construct function. 54 54 * 55 * @access public56 55 * @return void 57 56 */ 58 57 public function __construct() { 59 $this->import_page = ' woocommerce_tax_rate_csv';58 $this->import_page = 'nav_menu_items'; 60 59 } 61 60 -
nav-menu-roles/tags/2.1.3/inc/class-nav-menu-roles.php
r2844983 r3492100 41 41 * @since 1.7.0 42 42 */ 43 const VERSION = '2.1. 0';43 const VERSION = '2.1.3'; 44 44 45 45 /** … … 80 80 /** 81 81 * Nav_Menu_Roles Constructor. 82 * @access public83 82 * @return Nav_Menu_Roles 84 83 * @since 1.0 … … 101 100 // Add FAQ and Donate link to plugin. 102 101 add_filter( 'plugin_row_meta', array( $this, 'add_action_links' ), 10, 2 ); 103 104 // Maybe switch the admin walker.105 if ( ! self::is_wp_gte( '5.4' ) ) {106 add_filter( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' ) );107 }108 102 109 103 // Add new fields via hook. … … 132 126 /** 133 127 * Include the custom admin walker 134 *135 * @access public136 * @return void137 128 */ 138 129 public function admin_init() { … … 147 138 * Register the Importer 148 139 * the regular Importer skips post meta for the menu items 149 *150 * @access private151 * @return void152 140 */ 153 141 public function register_importer() { … … 337 325 338 326 // Alpha sort roles by label. 339 asort( $ wp_roles->role_names );327 asort( $display_roles ); 340 328 341 329 /** … … 374 362 $hidden = 'in' === $logged_in_out ? '' : 'display: none;'; 375 363 376 $float = is_rtl() ? 'float:"right";' : 'float:"left";';377 378 364 ?> 379 365 380 366 <input type="hidden" name="nav-menu-role-nonce" value="<?php echo esc_attr( wp_create_nonce( 'nav-menu-nonce-name' ) ); ?>" /> 381 367 382 <fieldset class="field-nav_menu_role nav_menu_display_mode_field description-wide" style="margin: 5px 0;">368 <fieldset class="field-nav_menu_role nav_menu_display_mode_field"> 383 369 <legend class="description"><?php esc_html_e( 'Display Mode', 'nav-menu-roles' ); ?></legend> 384 370 385 371 <input type="hidden" class="nav-menu-id" value="<?php echo esc_attr( $item->ID ); ?>" /> 386 372 387 <label for="nav_menu_show-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">373 <label for="nav_menu_show-for-<?php echo esc_attr( $item->ID ); ?>"> 388 374 <input type="radio" class="nav-menu-display-mode" name="nav-menu-display-mode[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_show-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'show', $display_mode ); ?> value="show" /> 389 375 <?php esc_html_e( 'Show', 'nav-menu-roles' ); ?> 390 376 </label> 391 377 392 <label for="nav_menu_hide-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">378 <label for="nav_menu_hide-for-<?php echo esc_attr( $item->ID ); ?>"> 393 379 <input type="radio" class="nav-menu-display-mode" name="nav-menu-display-mode[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_hide-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'hide', $display_mode ); ?> value="hide" /> 394 380 <?php esc_html_e( 'Hide', 'nav-menu-roles' ); ?> … … 397 383 </fieldset> 398 384 399 <fieldset class="field-nav_menu_role nav_menu_logged_in_out_field description-wide" style="margin: 5px 0;">385 <fieldset class="field-nav_menu_role nav_menu_logged_in_out_field"> 400 386 <legend class="description"><?php esc_html_e( 'Target audience', 'nav-menu-roles' ); ?></legend> 401 387 402 388 <input type="hidden" class="nav-menu-id" value="<?php echo esc_attr( $item->ID ); ?>" /> 403 389 404 <label for="nav_menu_logged_in-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">390 <label for="nav_menu_logged_in-for-<?php echo esc_attr( $item->ID ); ?>"> 405 391 <input type="radio" class="nav-menu-logged-in-out" name="nav-menu-logged-in-out[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_logged_in-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'in', $logged_in_out ); ?> value="in" /> 406 392 <?php esc_html_e( 'Logged In Users', 'nav-menu-roles' ); ?> 407 393 </label> 408 394 409 <label for="nav_menu_logged_out-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">395 <label for="nav_menu_logged_out-for-<?php echo esc_attr( $item->ID ); ?>"> 410 396 <input type="radio" class="nav-menu-logged-in-out" name="nav-menu-logged-in-out[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_logged_out-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'out', $logged_in_out ); ?> value="out" /> 411 397 <?php esc_html_e( 'Logged Out Users', 'nav-menu-roles' ); ?> 412 398 </label> 413 399 414 <label for="nav_menu_by_role-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 30%;">400 <label for="nav_menu_by_role-for-<?php echo esc_attr( $item->ID ); ?>"> 415 401 <input type="radio" class="nav-menu-logged-in-out" name="nav-menu-logged-in-out[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_by_role-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( '', $logged_in_out ); ?> value="" /> 416 402 <?php esc_html_e( 'Everyone', 'nav-menu-roles' ); ?> … … 419 405 </fieldset> 420 406 421 <fieldset class="field-nav_menu_role nav_menu_role_field description-wide" style=" margin: 5px 0;<?php echo esc_attr( $hidden ); ?>">407 <fieldset class="field-nav_menu_role nav_menu_role_field description-wide" style="<?php echo esc_attr( $hidden ); ?>"> 422 408 <legend class="description"><?php esc_html_e( 'Target role', 'nav-menu-roles' ); ?></legend> 423 409 … … 433 419 ?> 434 420 435 <label for="nav_menu_role-<?php echo esc_attr( $role ); ?>-for-<?php echo esc_attr( $item->ID ); ?>" style="display: block; margin: 2px 0;">421 <label for="nav_menu_role-<?php echo esc_attr( $role ); ?>-for-<?php echo esc_attr( $item->ID ); ?>"> 436 422 <input type="checkbox" name="nav-menu-role[<?php echo esc_attr( $item->ID ); ?>][<?php echo esc_attr( $i ); ?>]" id="nav_menu_role-<?php echo esc_attr( $role ); ?>-for-<?php echo esc_attr( $item->ID ); ?>" <?php echo esc_attr( $checked ); ?> value="<?php echo esc_attr( $role ); ?>" /> 437 423 <?php echo esc_html( $name ); ?> … … 454 440 public function enqueue_scripts( $hook ) { 455 441 if ( 'nav-menus.php' === $hook ) { 456 wp_enqueue_script( 'nav-menu-roles', plugins_url( 'dist/nav-menu-roles.js', $this->main_file ), array( 'jquery' ), self::VERSION, true ); 442 443 wp_enqueue_script( 'nav-menu-roles', plugins_url( 'assets/js/nav-menu-roles.js', $this->main_file ), array( 'jquery' ), self::VERSION, true ); 444 445 ?> 446 <style> 447 448 fieldset.field-nav_menu_role { margin: 0 0 1rem 0; } 449 fieldset.field-nav_menu_role legend { font-weight: bold; margin-bottom: .5rem; } 450 fieldset.nav_menu_display_mode_field > label, 451 fieldset.nav_menu_logged_in_out_field > label { 452 float: left; 453 margin: 0 .5rem 0 0; 454 } 455 fieldset.nav_menu_role_field { 456 column-count: 2; 457 } 458 fieldset.nav_menu_role_field > label { 459 display: block; 460 } 461 .rtl fieldset.nav_menu_display_mode_field > label, 462 .rtl fieldset.nav_menu_logged_in_out_field > label { 463 float: right; 464 margin: 0 0 0 .5rem; 465 } 466 </style> 467 <?php 457 468 } 458 469 } … … 643 654 /** 644 655 * Maybe upgrade 645 *646 * @access public647 * @return void648 656 */ 649 657 public function maybe_upgrade() { … … 659 667 * Test WordPress version 660 668 * 661 * @access public662 669 * @param string $version - A WordPress version to compare against current version. 663 670 * @return boolean -
nav-menu-roles/tags/2.1.3/inc/class-walker-nav-menu-edit-roles-4.7.php
r2371609 r3492100 40 40 * Get custom fields 41 41 * 42 * @access protected43 42 * @since 0.1.0 44 43 * @uses do_action() Calls 'menu_item_custom_fields' hook -
nav-menu-roles/tags/2.1.3/inc/customizer.php
r2684602 r3492100 25 25 26 26 // Workaround for previewing changes. 27 if ( \Nav_Menu_Roles::is_wp_gte( '4.9' ) ) { 28 add_action( 'customize_register', __NAMESPACE__ . '\customizer_preview', 1000 ); 29 } 27 add_action( 'customize_register', __NAMESPACE__ . '\customizer_preview', 1000 ); 30 28 31 29 // Workaround for saving changes. … … 106 104 */ 107 105 function customizer_scripts() { 108 $script_dependencies = include plugin_dir_path( __DIR__ ) . '/ dist/customize-controls.asset.php';106 $script_dependencies = include plugin_dir_path( __DIR__ ) . '/assets/js/customizer/controls.asset.php'; 109 107 wp_enqueue_script( 110 108 'customize-nav-menu-roles', 111 plugins_url( ' dist/customize-controls.js', dirname( __FILE__ ) ),109 plugins_url( 'assets/js/customizer/controls.js', dirname( __FILE__ ) ), 112 110 array_merge( array( 'customize-nav-menus' ), $script_dependencies['dependencies'] ), 113 111 $script_dependencies['version'], -
nav-menu-roles/tags/2.1.3/languages/nav-menu-roles.pot
r2844987 r3492100 1 # Copyright (C) 202 3Kathy Darling1 # Copyright (C) 2026 Kathy Darling 2 2 # This file is distributed under the GPL-3.0. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Nav Menu Roles 2.1. 2\n"5 "Project-Id-Version: Nav Menu Roles 2.1.3\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nav-menu-roles\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 202 3-01-07T20:43:48+00:00\n"12 "POT-Creation-Date: 2026-03-26T19:21:53+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 7.1\n"14 "X-Generator: WP-CLI 2.12.0\n" 15 15 "X-Domain: nav-menu-roles\n" 16 16 17 17 #. Plugin Name of the plugin 18 #: inc/class-nav-menu-roles.php:161 18 #: nav-menu-roles.php:3 19 #: inc/class-nav-menu-roles.php:149 19 20 msgid "Nav Menu Roles" 20 21 msgstr "" 21 22 22 23 #. Plugin URI of the plugin 24 #: nav-menu-roles.php:4 23 25 msgid "http://www.kathyisawesome.com/449/nav-menu-roles/" 24 26 msgstr "" 25 27 26 28 #. Description of the plugin 29 #: nav-menu-roles.php:5 27 30 msgid "Hide custom menu items based on user roles." 28 31 msgstr "" 29 32 30 33 #. Author of the plugin 34 #: nav-menu-roles.php:7 31 35 msgid "Kathy Darling" 32 36 msgstr "" 33 37 34 38 #. Author URI of the plugin 39 #: nav-menu-roles.php:8 35 40 msgid "http://www.kathyisawesome.com" 36 41 msgstr "" 37 42 43 #: inc/class-nav-menu-roles-import.php:112 44 #: inc/class-nav-menu-roles-import.php:121 45 #: inc/class-nav-menu-roles-import.php:167 46 #: inc/class-nav-menu-roles-import.php:171 47 #: inc/class-nav-menu-roles-import.php:181 48 msgid "Sorry, there has been an error." 49 msgstr "" 50 38 51 #: inc/class-nav-menu-roles-import.php:113 39 #: inc/class-nav-menu-roles-import.php:12240 #: inc/class-nav-menu-roles-import.php:16841 #: inc/class-nav-menu-roles-import.php:17242 #: inc/class-nav-menu-roles-import.php:18243 msgid "Sorry, there has been an error."44 msgstr ""45 46 #: inc/class-nav-menu-roles-import.php:11447 52 msgid "The file does not exist, please try again." 48 53 msgstr "" 49 54 50 #: inc/class-nav-menu-roles-import.php:15 355 #: inc/class-nav-menu-roles-import.php:152 51 56 msgid "All done." 52 57 msgstr "" 53 58 54 #: inc/class-nav-menu-roles-import.php:15 359 #: inc/class-nav-menu-roles-import.php:152 55 60 msgid "Have fun!" 56 61 msgstr "" 57 62 58 63 #. translators: %s is export file name. 59 #: inc/class-nav-menu-roles-import.php:174 64 #: inc/class-nav-menu-roles-import.php:173 65 #, php-format 60 66 msgid "The export file could not be found at %s. It is likely that this was caused by a permissions problem." 61 67 msgstr "" 62 68 63 69 #. translators: %s is file version number. 64 #: inc/class-nav-menu-roles-import.php:191 70 #: inc/class-nav-menu-roles-import.php:190 71 #, php-format 65 72 msgid "This WXR file (version %s) may not be supported by this version of the importer. Please consider updating." 66 73 msgstr "" 67 74 68 #: inc/class-nav-menu-roles-import.php:25 975 #: inc/class-nav-menu-roles-import.php:258 69 76 msgid "Import Nav Menu Roles" 70 77 msgstr "" 71 78 72 79 #. translators: %s is importer version number. 73 #: inc/class-nav-menu-roles-import.php:267 80 #: inc/class-nav-menu-roles-import.php:266 81 #, php-format 74 82 msgid "A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files." 75 83 msgstr "" 76 84 85 #: inc/class-nav-menu-roles-import.php:281 86 msgid "Re-Upload your normal WordPress eXtended RSS (WXR) file and we’ll import the Nav Menu Roles and any other missing post meta for the Nav Menu items." 87 msgstr "" 88 77 89 #: inc/class-nav-menu-roles-import.php:282 78 msgid "Re-Upload your normal WordPress eXtended RSS (WXR) file and we’ll import the Nav Menu Roles and any other missing post meta for the Nav Menu items."79 msgstr ""80 81 #: inc/class-nav-menu-roles-import.php:28382 90 msgid "Choose a WXR (.xml) file to upload, then click Upload file and import." 83 91 msgstr "" … … 91 99 msgstr "" 92 100 93 #: inc/class-nav-menu-roles.php:1 61101 #: inc/class-nav-menu-roles.php:149 94 102 msgid "Import <strong>nav menu roles</strong> and other menu item meta skipped by the default importer" 95 103 msgstr "" 96 104 97 #: inc/class-nav-menu-roles.php:2 93105 #: inc/class-nav-menu-roles.php:281 98 106 msgid "FAQ" 99 107 msgstr "" 100 108 101 #: inc/class-nav-menu-roles.php:2 94109 #: inc/class-nav-menu-roles.php:282 102 110 msgid "Donate" 103 111 msgstr "" 104 112 105 #: inc/class-nav-menu-roles.php:3 83106 #: inc/customizer.php:5 9113 #: inc/class-nav-menu-roles.php:369 114 #: inc/customizer.php:57 107 115 msgid "Display Mode" 108 116 msgstr "" 109 117 110 #: inc/class-nav-menu-roles.php:3 89111 #: inc/customizer.php:6 3118 #: inc/class-nav-menu-roles.php:375 119 #: inc/customizer.php:61 112 120 msgid "Show" 113 121 msgstr "" 114 122 115 #: inc/class-nav-menu-roles.php:3 94116 #: inc/customizer.php:6 8123 #: inc/class-nav-menu-roles.php:380 124 #: inc/customizer.php:66 117 125 msgid "Hide" 118 126 msgstr "" 119 127 120 #: inc/class-nav-menu-roles.php: 400128 #: inc/class-nav-menu-roles.php:386 121 129 msgid "Target audience" 122 130 msgstr "" 123 131 124 #: inc/class-nav-menu-roles.php: 406125 #: inc/customizer.php:7 8132 #: inc/class-nav-menu-roles.php:392 133 #: inc/customizer.php:76 126 134 msgid "Logged In Users" 127 135 msgstr "" 128 136 129 #: inc/class-nav-menu-roles.php: 411130 #: inc/customizer.php:8 2137 #: inc/class-nav-menu-roles.php:397 138 #: inc/customizer.php:80 131 139 msgid "Logged Out Users" 132 140 msgstr "" 133 141 134 #: inc/class-nav-menu-roles.php:4 16135 #: inc/customizer.php:8 6142 #: inc/class-nav-menu-roles.php:402 143 #: inc/customizer.php:84 136 144 msgid "Everyone" 137 145 msgstr "" 138 146 139 #: inc/class-nav-menu-roles.php:4 22147 #: inc/class-nav-menu-roles.php:408 140 148 msgid "Target role" 141 149 msgstr "" … … 144 152 #: inc/class-walker-nav-menu-edit-roles-4.5.php:101 145 153 #: inc/class-walker-nav-menu-edit-roles.php:109 154 #, php-format 146 155 msgid "%s (Invalid)" 147 156 msgstr "" … … 150 159 #: inc/class-walker-nav-menu-edit-roles-4.5.php:105 151 160 #: inc/class-walker-nav-menu-edit-roles.php:113 161 #, php-format 152 162 msgid "%s (Pending)" 153 163 msgstr "" … … 239 249 #: inc/class-walker-nav-menu-edit-roles-4.5.php:229 240 250 #: inc/class-walker-nav-menu-edit-roles.php:234 251 #, php-format 241 252 msgid "Original: %s" 242 253 msgstr "" … … 257 268 msgstr "" 258 269 259 #: inc/customizer.php:7 4270 #: inc/customizer.php:72 260 271 msgid "Target Audience" 261 272 msgstr "" 262 273 263 #: inc/customizer.php: 91274 #: inc/customizer.php:89 264 275 msgid "Target Roles" 265 276 msgstr "" -
nav-menu-roles/tags/2.1.3/nav-menu-roles.php
r2844987 r3492100 4 4 * Plugin URI: http://www.kathyisawesome.com/449/nav-menu-roles/ 5 5 * Description: Hide custom menu items based on user roles. 6 * Version: 2.1. 26 * Version: 2.1.3 7 7 * Author: Kathy Darling 8 8 * Author URI: http://www.kathyisawesome.com … … 10 10 * Text Domain: nav-menu-roles 11 11 * 12 * Copyright 202 0Kathy Darling12 * Copyright 2026 Kathy Darling 13 13 * 14 14 * This program is free software; you can redistribute it and/or modify -
nav-menu-roles/tags/2.1.3/readme.txt
r3465898 r3492100 2 2 3 3 Contributors: helgatheviking 4 Donate link: https:// www.paypal.com/fundraiser/charity/14513164 Donate link: https://paypal.me/helgatheviking 5 5 Tags: menu, menus, nav menu, nav menus 6 Requires at least: 4.5.07 Tested up to: 6. 8.08 Requires PHP: 5.3.26 Requires at least: 6.6.0 7 Tested up to: 6.9.0 8 Requires PHP: 7.4 9 9 Stable tag: 2.1.3 10 10 License: GPLv3 11 11 12 Hide custom menu items based on user roles. PLEASE READ THE FAQ IF YOU ARE NOT SEEING THE SETTINGS.12 Hide custom menu items based on user roles. 13 13 14 14 == Description == … … 32 32 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. 33 33 34 Please report any bugs, errors, warnings, code problems to [Git hub](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) 35 35 36 36 == Installation == … … 268 268 269 269 = 2.1.3 = 270 * Requires: PHP 7.4 and WordPress 6.3 270 271 * Fix: RTL layout style. 271 272 … … 331 332 332 333 = 1.8.1 = 333 * Switch input names to use a counter [nav-menu-role][100][1]. For some reason [nav-menu-role][100][] doesn't post an array and hyp enated names [nav-menu-role][100][gold-plan] wreak havoc on the save routine. Shouldn't impact anyone not using hyphenated role names.334 * Switch input names to use a counter [nav-menu-role][100][1]. For some reason [nav-menu-role][100][] doesn't post an array and hyphenated names [nav-menu-role][100][gold-plan] wreak havoc on the save routine. Shouldn't impact anyone not using hyphenated role names. 334 335 335 336 = 1.8.0 = … … 363 364 = 1.7.1 = 364 365 * Updated FAQ with patch instructions for conflicting plugins/themes 365 * add Portug euse language. props @brunobarros366 * add Portuguese language. props @brunobarros 366 367 367 368 = 1.7.0 = -
nav-menu-roles/trunk/inc/class-nav-menu-roles-import.php
r2844987 r3492100 53 53 * __construct function. 54 54 * 55 * @access public56 55 * @return void 57 56 */ 58 57 public function __construct() { 59 $this->import_page = ' woocommerce_tax_rate_csv';58 $this->import_page = 'nav_menu_items'; 60 59 } 61 60 -
nav-menu-roles/trunk/inc/class-nav-menu-roles.php
r2844983 r3492100 41 41 * @since 1.7.0 42 42 */ 43 const VERSION = '2.1. 0';43 const VERSION = '2.1.3'; 44 44 45 45 /** … … 80 80 /** 81 81 * Nav_Menu_Roles Constructor. 82 * @access public83 82 * @return Nav_Menu_Roles 84 83 * @since 1.0 … … 101 100 // Add FAQ and Donate link to plugin. 102 101 add_filter( 'plugin_row_meta', array( $this, 'add_action_links' ), 10, 2 ); 103 104 // Maybe switch the admin walker.105 if ( ! self::is_wp_gte( '5.4' ) ) {106 add_filter( 'wp_edit_nav_menu_walker', array( $this, 'edit_nav_menu_walker' ) );107 }108 102 109 103 // Add new fields via hook. … … 132 126 /** 133 127 * Include the custom admin walker 134 *135 * @access public136 * @return void137 128 */ 138 129 public function admin_init() { … … 147 138 * Register the Importer 148 139 * the regular Importer skips post meta for the menu items 149 *150 * @access private151 * @return void152 140 */ 153 141 public function register_importer() { … … 337 325 338 326 // Alpha sort roles by label. 339 asort( $ wp_roles->role_names );327 asort( $display_roles ); 340 328 341 329 /** … … 374 362 $hidden = 'in' === $logged_in_out ? '' : 'display: none;'; 375 363 376 $float = is_rtl() ? 'float:"right";' : 'float:"left";';377 378 364 ?> 379 365 380 366 <input type="hidden" name="nav-menu-role-nonce" value="<?php echo esc_attr( wp_create_nonce( 'nav-menu-nonce-name' ) ); ?>" /> 381 367 382 <fieldset class="field-nav_menu_role nav_menu_display_mode_field description-wide" style="margin: 5px 0;">368 <fieldset class="field-nav_menu_role nav_menu_display_mode_field"> 383 369 <legend class="description"><?php esc_html_e( 'Display Mode', 'nav-menu-roles' ); ?></legend> 384 370 385 371 <input type="hidden" class="nav-menu-id" value="<?php echo esc_attr( $item->ID ); ?>" /> 386 372 387 <label for="nav_menu_show-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">373 <label for="nav_menu_show-for-<?php echo esc_attr( $item->ID ); ?>"> 388 374 <input type="radio" class="nav-menu-display-mode" name="nav-menu-display-mode[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_show-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'show', $display_mode ); ?> value="show" /> 389 375 <?php esc_html_e( 'Show', 'nav-menu-roles' ); ?> 390 376 </label> 391 377 392 <label for="nav_menu_hide-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">378 <label for="nav_menu_hide-for-<?php echo esc_attr( $item->ID ); ?>"> 393 379 <input type="radio" class="nav-menu-display-mode" name="nav-menu-display-mode[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_hide-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'hide', $display_mode ); ?> value="hide" /> 394 380 <?php esc_html_e( 'Hide', 'nav-menu-roles' ); ?> … … 397 383 </fieldset> 398 384 399 <fieldset class="field-nav_menu_role nav_menu_logged_in_out_field description-wide" style="margin: 5px 0;">385 <fieldset class="field-nav_menu_role nav_menu_logged_in_out_field"> 400 386 <legend class="description"><?php esc_html_e( 'Target audience', 'nav-menu-roles' ); ?></legend> 401 387 402 388 <input type="hidden" class="nav-menu-id" value="<?php echo esc_attr( $item->ID ); ?>" /> 403 389 404 <label for="nav_menu_logged_in-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">390 <label for="nav_menu_logged_in-for-<?php echo esc_attr( $item->ID ); ?>"> 405 391 <input type="radio" class="nav-menu-logged-in-out" name="nav-menu-logged-in-out[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_logged_in-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'in', $logged_in_out ); ?> value="in" /> 406 392 <?php esc_html_e( 'Logged In Users', 'nav-menu-roles' ); ?> 407 393 </label> 408 394 409 <label for="nav_menu_logged_out-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 35%;">395 <label for="nav_menu_logged_out-for-<?php echo esc_attr( $item->ID ); ?>"> 410 396 <input type="radio" class="nav-menu-logged-in-out" name="nav-menu-logged-in-out[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_logged_out-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( 'out', $logged_in_out ); ?> value="out" /> 411 397 <?php esc_html_e( 'Logged Out Users', 'nav-menu-roles' ); ?> 412 398 </label> 413 399 414 <label for="nav_menu_by_role-for-<?php echo esc_attr( $item->ID ); ?>" style="<?php echo esc_attr( $float ); ?> width: 30%;">400 <label for="nav_menu_by_role-for-<?php echo esc_attr( $item->ID ); ?>"> 415 401 <input type="radio" class="nav-menu-logged-in-out" name="nav-menu-logged-in-out[<?php echo esc_attr( $item->ID ); ?>]" id="nav_menu_by_role-for-<?php echo esc_attr( $item->ID ); ?>" <?php checked( '', $logged_in_out ); ?> value="" /> 416 402 <?php esc_html_e( 'Everyone', 'nav-menu-roles' ); ?> … … 419 405 </fieldset> 420 406 421 <fieldset class="field-nav_menu_role nav_menu_role_field description-wide" style=" margin: 5px 0;<?php echo esc_attr( $hidden ); ?>">407 <fieldset class="field-nav_menu_role nav_menu_role_field description-wide" style="<?php echo esc_attr( $hidden ); ?>"> 422 408 <legend class="description"><?php esc_html_e( 'Target role', 'nav-menu-roles' ); ?></legend> 423 409 … … 433 419 ?> 434 420 435 <label for="nav_menu_role-<?php echo esc_attr( $role ); ?>-for-<?php echo esc_attr( $item->ID ); ?>" style="display: block; margin: 2px 0;">421 <label for="nav_menu_role-<?php echo esc_attr( $role ); ?>-for-<?php echo esc_attr( $item->ID ); ?>"> 436 422 <input type="checkbox" name="nav-menu-role[<?php echo esc_attr( $item->ID ); ?>][<?php echo esc_attr( $i ); ?>]" id="nav_menu_role-<?php echo esc_attr( $role ); ?>-for-<?php echo esc_attr( $item->ID ); ?>" <?php echo esc_attr( $checked ); ?> value="<?php echo esc_attr( $role ); ?>" /> 437 423 <?php echo esc_html( $name ); ?> … … 454 440 public function enqueue_scripts( $hook ) { 455 441 if ( 'nav-menus.php' === $hook ) { 456 wp_enqueue_script( 'nav-menu-roles', plugins_url( 'dist/nav-menu-roles.js', $this->main_file ), array( 'jquery' ), self::VERSION, true ); 442 443 wp_enqueue_script( 'nav-menu-roles', plugins_url( 'assets/js/nav-menu-roles.js', $this->main_file ), array( 'jquery' ), self::VERSION, true ); 444 445 ?> 446 <style> 447 448 fieldset.field-nav_menu_role { margin: 0 0 1rem 0; } 449 fieldset.field-nav_menu_role legend { font-weight: bold; margin-bottom: .5rem; } 450 fieldset.nav_menu_display_mode_field > label, 451 fieldset.nav_menu_logged_in_out_field > label { 452 float: left; 453 margin: 0 .5rem 0 0; 454 } 455 fieldset.nav_menu_role_field { 456 column-count: 2; 457 } 458 fieldset.nav_menu_role_field > label { 459 display: block; 460 } 461 .rtl fieldset.nav_menu_display_mode_field > label, 462 .rtl fieldset.nav_menu_logged_in_out_field > label { 463 float: right; 464 margin: 0 0 0 .5rem; 465 } 466 </style> 467 <?php 457 468 } 458 469 } … … 643 654 /** 644 655 * Maybe upgrade 645 *646 * @access public647 * @return void648 656 */ 649 657 public function maybe_upgrade() { … … 659 667 * Test WordPress version 660 668 * 661 * @access public662 669 * @param string $version - A WordPress version to compare against current version. 663 670 * @return boolean -
nav-menu-roles/trunk/inc/class-walker-nav-menu-edit-roles-4.7.php
r2371609 r3492100 40 40 * Get custom fields 41 41 * 42 * @access protected43 42 * @since 0.1.0 44 43 * @uses do_action() Calls 'menu_item_custom_fields' hook -
nav-menu-roles/trunk/inc/customizer.php
r2684602 r3492100 25 25 26 26 // Workaround for previewing changes. 27 if ( \Nav_Menu_Roles::is_wp_gte( '4.9' ) ) { 28 add_action( 'customize_register', __NAMESPACE__ . '\customizer_preview', 1000 ); 29 } 27 add_action( 'customize_register', __NAMESPACE__ . '\customizer_preview', 1000 ); 30 28 31 29 // Workaround for saving changes. … … 106 104 */ 107 105 function customizer_scripts() { 108 $script_dependencies = include plugin_dir_path( __DIR__ ) . '/ dist/customize-controls.asset.php';106 $script_dependencies = include plugin_dir_path( __DIR__ ) . '/assets/js/customizer/controls.asset.php'; 109 107 wp_enqueue_script( 110 108 'customize-nav-menu-roles', 111 plugins_url( ' dist/customize-controls.js', dirname( __FILE__ ) ),109 plugins_url( 'assets/js/customizer/controls.js', dirname( __FILE__ ) ), 112 110 array_merge( array( 'customize-nav-menus' ), $script_dependencies['dependencies'] ), 113 111 $script_dependencies['version'], -
nav-menu-roles/trunk/languages/nav-menu-roles.pot
r2844987 r3492100 1 # Copyright (C) 202 3Kathy Darling1 # Copyright (C) 2026 Kathy Darling 2 2 # This file is distributed under the GPL-3.0. 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Nav Menu Roles 2.1. 2\n"5 "Project-Id-Version: Nav Menu Roles 2.1.3\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/nav-menu-roles\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 202 3-01-07T20:43:48+00:00\n"12 "POT-Creation-Date: 2026-03-26T19:21:53+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2. 7.1\n"14 "X-Generator: WP-CLI 2.12.0\n" 15 15 "X-Domain: nav-menu-roles\n" 16 16 17 17 #. Plugin Name of the plugin 18 #: inc/class-nav-menu-roles.php:161 18 #: nav-menu-roles.php:3 19 #: inc/class-nav-menu-roles.php:149 19 20 msgid "Nav Menu Roles" 20 21 msgstr "" 21 22 22 23 #. Plugin URI of the plugin 24 #: nav-menu-roles.php:4 23 25 msgid "http://www.kathyisawesome.com/449/nav-menu-roles/" 24 26 msgstr "" 25 27 26 28 #. Description of the plugin 29 #: nav-menu-roles.php:5 27 30 msgid "Hide custom menu items based on user roles." 28 31 msgstr "" 29 32 30 33 #. Author of the plugin 34 #: nav-menu-roles.php:7 31 35 msgid "Kathy Darling" 32 36 msgstr "" 33 37 34 38 #. Author URI of the plugin 39 #: nav-menu-roles.php:8 35 40 msgid "http://www.kathyisawesome.com" 36 41 msgstr "" 37 42 43 #: inc/class-nav-menu-roles-import.php:112 44 #: inc/class-nav-menu-roles-import.php:121 45 #: inc/class-nav-menu-roles-import.php:167 46 #: inc/class-nav-menu-roles-import.php:171 47 #: inc/class-nav-menu-roles-import.php:181 48 msgid "Sorry, there has been an error." 49 msgstr "" 50 38 51 #: inc/class-nav-menu-roles-import.php:113 39 #: inc/class-nav-menu-roles-import.php:12240 #: inc/class-nav-menu-roles-import.php:16841 #: inc/class-nav-menu-roles-import.php:17242 #: inc/class-nav-menu-roles-import.php:18243 msgid "Sorry, there has been an error."44 msgstr ""45 46 #: inc/class-nav-menu-roles-import.php:11447 52 msgid "The file does not exist, please try again." 48 53 msgstr "" 49 54 50 #: inc/class-nav-menu-roles-import.php:15 355 #: inc/class-nav-menu-roles-import.php:152 51 56 msgid "All done." 52 57 msgstr "" 53 58 54 #: inc/class-nav-menu-roles-import.php:15 359 #: inc/class-nav-menu-roles-import.php:152 55 60 msgid "Have fun!" 56 61 msgstr "" 57 62 58 63 #. translators: %s is export file name. 59 #: inc/class-nav-menu-roles-import.php:174 64 #: inc/class-nav-menu-roles-import.php:173 65 #, php-format 60 66 msgid "The export file could not be found at %s. It is likely that this was caused by a permissions problem." 61 67 msgstr "" 62 68 63 69 #. translators: %s is file version number. 64 #: inc/class-nav-menu-roles-import.php:191 70 #: inc/class-nav-menu-roles-import.php:190 71 #, php-format 65 72 msgid "This WXR file (version %s) may not be supported by this version of the importer. Please consider updating." 66 73 msgstr "" 67 74 68 #: inc/class-nav-menu-roles-import.php:25 975 #: inc/class-nav-menu-roles-import.php:258 69 76 msgid "Import Nav Menu Roles" 70 77 msgstr "" 71 78 72 79 #. translators: %s is importer version number. 73 #: inc/class-nav-menu-roles-import.php:267 80 #: inc/class-nav-menu-roles-import.php:266 81 #, php-format 74 82 msgid "A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files." 75 83 msgstr "" 76 84 85 #: inc/class-nav-menu-roles-import.php:281 86 msgid "Re-Upload your normal WordPress eXtended RSS (WXR) file and we’ll import the Nav Menu Roles and any other missing post meta for the Nav Menu items." 87 msgstr "" 88 77 89 #: inc/class-nav-menu-roles-import.php:282 78 msgid "Re-Upload your normal WordPress eXtended RSS (WXR) file and we’ll import the Nav Menu Roles and any other missing post meta for the Nav Menu items."79 msgstr ""80 81 #: inc/class-nav-menu-roles-import.php:28382 90 msgid "Choose a WXR (.xml) file to upload, then click Upload file and import." 83 91 msgstr "" … … 91 99 msgstr "" 92 100 93 #: inc/class-nav-menu-roles.php:1 61101 #: inc/class-nav-menu-roles.php:149 94 102 msgid "Import <strong>nav menu roles</strong> and other menu item meta skipped by the default importer" 95 103 msgstr "" 96 104 97 #: inc/class-nav-menu-roles.php:2 93105 #: inc/class-nav-menu-roles.php:281 98 106 msgid "FAQ" 99 107 msgstr "" 100 108 101 #: inc/class-nav-menu-roles.php:2 94109 #: inc/class-nav-menu-roles.php:282 102 110 msgid "Donate" 103 111 msgstr "" 104 112 105 #: inc/class-nav-menu-roles.php:3 83106 #: inc/customizer.php:5 9113 #: inc/class-nav-menu-roles.php:369 114 #: inc/customizer.php:57 107 115 msgid "Display Mode" 108 116 msgstr "" 109 117 110 #: inc/class-nav-menu-roles.php:3 89111 #: inc/customizer.php:6 3118 #: inc/class-nav-menu-roles.php:375 119 #: inc/customizer.php:61 112 120 msgid "Show" 113 121 msgstr "" 114 122 115 #: inc/class-nav-menu-roles.php:3 94116 #: inc/customizer.php:6 8123 #: inc/class-nav-menu-roles.php:380 124 #: inc/customizer.php:66 117 125 msgid "Hide" 118 126 msgstr "" 119 127 120 #: inc/class-nav-menu-roles.php: 400128 #: inc/class-nav-menu-roles.php:386 121 129 msgid "Target audience" 122 130 msgstr "" 123 131 124 #: inc/class-nav-menu-roles.php: 406125 #: inc/customizer.php:7 8132 #: inc/class-nav-menu-roles.php:392 133 #: inc/customizer.php:76 126 134 msgid "Logged In Users" 127 135 msgstr "" 128 136 129 #: inc/class-nav-menu-roles.php: 411130 #: inc/customizer.php:8 2137 #: inc/class-nav-menu-roles.php:397 138 #: inc/customizer.php:80 131 139 msgid "Logged Out Users" 132 140 msgstr "" 133 141 134 #: inc/class-nav-menu-roles.php:4 16135 #: inc/customizer.php:8 6142 #: inc/class-nav-menu-roles.php:402 143 #: inc/customizer.php:84 136 144 msgid "Everyone" 137 145 msgstr "" 138 146 139 #: inc/class-nav-menu-roles.php:4 22147 #: inc/class-nav-menu-roles.php:408 140 148 msgid "Target role" 141 149 msgstr "" … … 144 152 #: inc/class-walker-nav-menu-edit-roles-4.5.php:101 145 153 #: inc/class-walker-nav-menu-edit-roles.php:109 154 #, php-format 146 155 msgid "%s (Invalid)" 147 156 msgstr "" … … 150 159 #: inc/class-walker-nav-menu-edit-roles-4.5.php:105 151 160 #: inc/class-walker-nav-menu-edit-roles.php:113 161 #, php-format 152 162 msgid "%s (Pending)" 153 163 msgstr "" … … 239 249 #: inc/class-walker-nav-menu-edit-roles-4.5.php:229 240 250 #: inc/class-walker-nav-menu-edit-roles.php:234 251 #, php-format 241 252 msgid "Original: %s" 242 253 msgstr "" … … 257 268 msgstr "" 258 269 259 #: inc/customizer.php:7 4270 #: inc/customizer.php:72 260 271 msgid "Target Audience" 261 272 msgstr "" 262 273 263 #: inc/customizer.php: 91274 #: inc/customizer.php:89 264 275 msgid "Target Roles" 265 276 msgstr "" -
nav-menu-roles/trunk/nav-menu-roles.php
r2844987 r3492100 4 4 * Plugin URI: http://www.kathyisawesome.com/449/nav-menu-roles/ 5 5 * Description: Hide custom menu items based on user roles. 6 * Version: 2.1. 26 * Version: 2.1.3 7 7 * Author: Kathy Darling 8 8 * Author URI: http://www.kathyisawesome.com … … 10 10 * Text Domain: nav-menu-roles 11 11 * 12 * Copyright 202 0Kathy Darling12 * Copyright 2026 Kathy Darling 13 13 * 14 14 * This program is free software; you can redistribute it and/or modify -
nav-menu-roles/trunk/readme.txt
r3465898 r3492100 2 2 3 3 Contributors: helgatheviking 4 Donate link: https:// www.paypal.com/fundraiser/charity/14513164 Donate link: https://paypal.me/helgatheviking 5 5 Tags: menu, menus, nav menu, nav menus 6 Requires at least: 4.5.07 Tested up to: 6. 8.08 Requires PHP: 5.3.26 Requires at least: 6.6.0 7 Tested up to: 6.9.0 8 Requires PHP: 7.4 9 9 Stable tag: 2.1.3 10 10 License: GPLv3 11 11 12 Hide custom menu items based on user roles. PLEASE READ THE FAQ IF YOU ARE NOT SEEING THE SETTINGS.12 Hide custom menu items based on user roles. 13 13 14 14 == Description == … … 32 32 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. 33 33 34 Please report any bugs, errors, warnings, code problems to [Git hub](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) 35 35 36 36 == Installation == … … 268 268 269 269 = 2.1.3 = 270 * Requires: PHP 7.4 and WordPress 6.3 270 271 * Fix: RTL layout style. 271 272 … … 331 332 332 333 = 1.8.1 = 333 * Switch input names to use a counter [nav-menu-role][100][1]. For some reason [nav-menu-role][100][] doesn't post an array and hyp enated names [nav-menu-role][100][gold-plan] wreak havoc on the save routine. Shouldn't impact anyone not using hyphenated role names.334 * Switch input names to use a counter [nav-menu-role][100][1]. For some reason [nav-menu-role][100][] doesn't post an array and hyphenated names [nav-menu-role][100][gold-plan] wreak havoc on the save routine. Shouldn't impact anyone not using hyphenated role names. 334 335 335 336 = 1.8.0 = … … 363 364 = 1.7.1 = 364 365 * Updated FAQ with patch instructions for conflicting plugins/themes 365 * add Portug euse language. props @brunobarros366 * add Portuguese language. props @brunobarros 366 367 367 368 = 1.7.0 =
Note: See TracChangeset
for help on using the changeset viewer.