Nested Pages - Version 3.1.21

Version Description

  • Fixes issue where Nested Pages menu persists in some instances when "Disable menu completely" is checked/enabled.
  • Tested with WordPress V6
  • Security Updates
Download this release

Release Info

Developer kylephillips
Plugin Icon 128x128 Nested Pages
Version 3.1.21
Comparing to
See all releases

Code changes from version 3.1.20 to 3.1.21

app/Config/AdminMenuSettings.php CHANGED
@@ -88,6 +88,7 @@ class AdminMenuSettings
88
  public function submenuItems($menu_item, $role)
89
  {
90
  // Get all submenus
 
91
  $unordered_menu = $this->np_menu_original[$role['name']];
92
  $unordered_submenus = [];
93
  foreach ( $unordered_menu as $unordered_menu_item ){
88
  public function submenuItems($menu_item, $role)
89
  {
90
  // Get all submenus
91
+ if ( !array_key_exists($role['name'], $this->np_menu_original) ) return $menu_item;
92
  $unordered_menu = $this->np_menu_original[$role['name']];
93
  $unordered_submenus = [];
94
  foreach ( $unordered_menu as $unordered_menu_item ){
app/Config/Settings.php CHANGED
@@ -64,7 +64,6 @@ class Settings
64
  {
65
  add_action( 'admin_menu', [$this, 'registerSettingsPage' ]);
66
  add_action( 'admin_init', [$this, 'registerSettings']);
67
- add_action( 'updated_option', [$this, 'updateMenuName'], 10, 3);
68
  $this->user_repo = new UserRepository;
69
  $this->settings = new SettingsRepository;
70
  $this->post_type_repo = new PostTypeRepository;
@@ -104,27 +103,6 @@ class Settings
104
  register_setting( 'nestedpages-admincustomization', 'nestedpages_admin' );
105
  }
106
 
107
- /**
108
- * Update the menu name if option is updated
109
- * @see updated_option in wp-includes/option.php
110
- * @since 1.1.5
111
- */
112
- public function updateMenuName($option, $old_value, $value)
113
- {
114
- if ( $option == 'nestedpages_menu' ){
115
-
116
- $menu = get_term_by('id', $old_value, 'nav_menu');
117
- if ( $menu ) {
118
- delete_option('nestedpages_menu'); // Delete the option to prevent infinite loop
119
- update_option('nestedpages_menu', $old_value);
120
- wp_update_term($menu->term_id, 'nav_menu', [
121
- 'name' => $value,
122
- 'slug' => sanitize_title($value)
123
- ]);
124
- }
125
- }
126
- }
127
-
128
  /**
129
  * Set the Menu Object
130
  * @since 1.1.5
64
  {
65
  add_action( 'admin_menu', [$this, 'registerSettingsPage' ]);
66
  add_action( 'admin_init', [$this, 'registerSettings']);
 
67
  $this->user_repo = new UserRepository;
68
  $this->settings = new SettingsRepository;
69
  $this->post_type_repo = new PostTypeRepository;
103
  register_setting( 'nestedpages-admincustomization', 'nestedpages_admin' );
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  /**
107
  * Set the Menu Object
108
  * @since 1.1.5
app/Entities/NavMenu/NavMenuActions.php CHANGED
@@ -16,8 +16,6 @@ class NavMenuActions
16
 
17
  public function __construct()
18
  {
19
- if ( get_option('nestedpages_menusync') !== 'sync' ) return;
20
- if ( get_option('nestedpages_disable_menu') == 'true' ) return;
21
  $this->nav_menu_repo = new NavMenuRepository;
22
  $this->addUpdateHook();
23
  }
@@ -37,6 +35,8 @@ class NavMenuActions
37
  */
38
  public function syncMenu($menu_id, $menu_data = null)
39
  {
 
 
40
  if ( $menu_id !== $this->nav_menu_repo->getMenuID() ) return; // Don't try to sync menus not managed by NP
41
  $this->removeUpdateHook();
42
  if ( $menu_data == null ) $sync = new NavMenuSyncMenu($menu_id);
16
 
17
  public function __construct()
18
  {
 
 
19
  $this->nav_menu_repo = new NavMenuRepository;
20
  $this->addUpdateHook();
21
  }
35
  */
36
  public function syncMenu($menu_id, $menu_data = null)
37
  {
38
+ if ( get_option('nestedpages_menusync') !== 'sync' ) return;
39
+ if ( get_option('nestedpages_disable_menu') == 'true' ) return;
40
  if ( $menu_id !== $this->nav_menu_repo->getMenuID() ) return; // Don't try to sync menus not managed by NP
41
  $this->removeUpdateHook();
42
  if ( $menu_data == null ) $sync = new NavMenuSyncMenu($menu_id);
app/Entities/PostType/PostTypeRepository.php CHANGED
@@ -58,7 +58,8 @@ class PostTypeRepository
58
  $enabled_types = $this->enabled_post_types;
59
  $invalid_types = [
60
  'acf-field-group',
61
- 'attachment'
 
62
  ];
63
  foreach($all_types as $key => $type){
64
  if ( in_array($type->name, $invalid_types) ) continue;
58
  $enabled_types = $this->enabled_post_types;
59
  $invalid_types = [
60
  'acf-field-group',
61
+ 'attachment',
62
+ 'wp_block'
63
  ];
64
  foreach($all_types as $key => $type){
65
  if ( in_array($type->name, $invalid_types) ) continue;
app/NestedPages.php CHANGED
@@ -12,7 +12,7 @@ class NestedPages
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
- $np_version = '3.1.20';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
+ $np_version = '3.1.21';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
app/Views/settings/settings-general.php CHANGED
@@ -18,18 +18,6 @@ $sync_status = ( $this->settings->menuSyncEnabled() ) ? __('Currently Enabled',
18
  </div>
19
  </div><!-- .row -->
20
 
21
- <?php if ( !$this->settings->menusDisabled() ) : ?>
22
- <div class="row">
23
- <div class="description">
24
- <p><strong><?php _e('Menu Name', 'wp-nested-pages'); ?></strong></p>
25
- <p><?php _e('Important: Once the menu name has changed, theme files should be updated to reference the new name.', 'wp-nested-pages'); ?></p>
26
- </div>
27
- <div class="field">
28
- <input type="text" name="nestedpages_menu" id="nestedpages_menu" value="<?php echo $this->menu->name; ?>">
29
- </div>
30
- </div><!-- .row -->
31
- <?php endif; ?>
32
-
33
  <div class="row">
34
  <div class="description">
35
  <p><strong><?php _e('Display Options', 'wp-nested-pages'); ?></strong></p>
@@ -54,20 +42,20 @@ $sync_status = ( $this->settings->menuSyncEnabled() ) ? __('Currently Enabled',
54
  <?php if ( !$this->settings->menusDisabled() ) : ?>
55
  <p data-menu-enabled-option data-menu-hide-checkbox>
56
  <label>
57
- <input type="checkbox" name="nestedpages_ui[hide_menu_sync]" value="true" <?php if ( $this->settings->hideMenuSync() ) echo 'checked'; ?> />
58
  <?php printf(__('Hide Menu Sync Checkbox (%s)', 'wp-nested-pages'), esc_html($sync_status)); ?>
59
  </label>
60
  </p>
61
  <p data-menu-enabled-option data-menu-private>
62
  <label>
63
- <input type="checkbox" name="nestedpages_ui[include_private]" value="true" <?php if ( $this->settings->privateMenuEnabled() ) echo 'checked'; ?> />
64
  <?php _e('Include private items in the menu.', 'wp-nested-pages'); ?>
65
  </label>
66
  </p>
67
  <?php endif; ?>
68
  <p data-menu-enabled-option data-menu-disable-auto>
69
  <label>
70
- <input type="checkbox" name="nestedpages_ui[manual_menu_sync]" value="true" <?php if ( $this->settings->autoMenuDisabled() ) echo 'checked'; ?> data-menu-disable-auto-checkbox />
71
  <?php _e('Manually sync menu.', 'wp-nested-pages'); ?>
72
  </label>
73
  </p>
18
  </div>
19
  </div><!-- .row -->
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  <div class="row">
22
  <div class="description">
23
  <p><strong><?php _e('Display Options', 'wp-nested-pages'); ?></strong></p>
42
  <?php if ( !$this->settings->menusDisabled() ) : ?>
43
  <p data-menu-enabled-option data-menu-hide-checkbox>
44
  <label>
45
+ <input type="checkbox" name="nestedpages_ui[hide_menu_sync]" value="true" <?php if ( $this->settings->hideMenuSync() && !$this->settings->menusDisabled() ) echo 'checked'; ?> />
46
  <?php printf(__('Hide Menu Sync Checkbox (%s)', 'wp-nested-pages'), esc_html($sync_status)); ?>
47
  </label>
48
  </p>
49
  <p data-menu-enabled-option data-menu-private>
50
  <label>
51
+ <input type="checkbox" name="nestedpages_ui[include_private]" value="true" <?php if ( $this->settings->privateMenuEnabled() && !$this->settings->menusDisabled() ) echo 'checked'; ?> />
52
  <?php _e('Include private items in the menu.', 'wp-nested-pages'); ?>
53
  </label>
54
  </p>
55
  <?php endif; ?>
56
  <p data-menu-enabled-option data-menu-disable-auto>
57
  <label>
58
+ <input type="checkbox" name="nestedpages_ui[manual_menu_sync]" value="true" <?php if ( $this->settings->autoMenuDisabled() && !$this->settings->menusDisabled() ) echo 'checked'; ?> data-menu-disable-auto-checkbox />
59
  <?php _e('Manually sync menu.', 'wp-nested-pages'); ?>
60
  </label>
61
  </p>
nestedpages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Nested Pages
4
  Plugin URI: http://nestedpages.com
5
  Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
6
- Version: 3.1.20
7
  Author: Kyle Phillips
8
  Author URI: https://github.com/kylephillips
9
  Text Domain: wp-nested-pages
3
  Plugin Name: Nested Pages
4
  Plugin URI: http://nestedpages.com
5
  Description: Provides an intuitive drag and drop interface for managing pages in the Wordpress admin, while enhancing quick edit. Includes an auto-generated menu to match the nested interface, support for all post types and more.
6
+ Version: 3.1.21
7
  Author: Kyle Phillips
8
  Author URI: https://github.com/kylephillips
9
  Text Domain: wp-nested-pages
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: kylephillips
3
  Donate link: https://github.com/sponsors/kylephillips/
4
  Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
5
  Requires at least: 3.8
6
- Tested up to: 5.9
7
  Requires PHP: 5.4
8
- Stable tag: 3.1.19
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -105,6 +105,11 @@ No. The menu synchronization currently only works within the pages post type.
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
108
  = 3.1.20 =
109
  * Fixes bug where menu item descriptions (Added in the Appearance > Menus interface) were being removed when synchronizing the Nested Pages menu
110
  * Removes deprecation notice from authors dropdown in quick edit interface
3
  Donate link: https://github.com/sponsors/kylephillips/
4
  Tags: pages, admin, nested, tree view, page tree, sort, quick edit, structure
5
  Requires at least: 3.8
6
+ Tested up to: 6.0
7
  Requires PHP: 5.4
8
+ Stable tag: 3.1.20
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
105
 
106
  == Changelog ==
107
 
108
+ = 3.1.21 =
109
+ * Fixes issue where Nested Pages menu persists in some instances when "Disable menu completely" is checked/enabled.
110
+ * Tested with WordPress V6
111
+ * Security Updates
112
+
113
  = 3.1.20 =
114
  * Fixes bug where menu item descriptions (Added in the Appearance > Menus interface) were being removed when synchronizing the Nested Pages menu
115
  * Removes deprecation notice from authors dropdown in quick edit interface