Nested Pages - Version 3.1.20

Version Description

  • Fixes bug where menu item descriptions (Added in the Appearance > Menus interface) were being removed when synchronizing the Nested Pages menu
  • Removes deprecation notice from authors dropdown in quick edit interface
  • Adds 'nestedpages_row_parent_css_classes' developer filter for filtering css classes output in each row's parent
  • element
  • Adds 'nestedpages_new_post' developer filter for filtering new posts before they are added (through child pages or through the "Add Multiple" interface)
Download this release

Release Info

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

Code changes from version 3.1.19 to 3.1.20

app/Entities/Listing/Listing.php CHANGED
@@ -408,29 +408,28 @@ class Listing
408
 
409
  if ( $this->post->status !== 'trash' ) :
410
 
411
- echo '<li id="menuItem_' . esc_attr($this->post->id) . '" class="page-row';
412
-
413
  // Post Type
414
- echo ' post-type-' . esc_attr($this->post->post_type);
415
 
416
- // Assigned to manage a post type?
417
- if ( $this->listing_repo->isAssignedPostType($this->post->id, $this->assigned_pt_pages) ) echo ' is-page-assignment';
418
 
419
  // Published?
420
- if ( $this->post->status == 'publish' ) echo ' published';
421
- if ( $this->post->status == 'draft' ) echo ' draft';
422
-
423
  // Hidden in Nested Pages?
424
- if ( $this->post->np_status == 'hide' ) echo ' np-hide';
425
 
426
  // User Status Preference
427
- if ( $this->status_preference == 'published' && $this->post->status == 'draft' ) echo ' np-hide';
428
- if ( $this->status_preference == 'draft' && $this->post->status !== 'draft' ) echo ' np-hide';
429
 
430
  // Taxonomies
431
- echo ' ' . $this->post_repo->getTaxonomyCSS($this->post, $this->h_taxonomies, $this->f_taxonomies);
432
-
433
- echo '">';
434
 
435
  $count++;
436
 
408
 
409
  if ( $this->post->status !== 'trash' ) :
410
 
411
+ $row_parent_classes = 'page-row';
 
412
  // Post Type
413
+ $row_parent_classes .= ' post-type-' . esc_attr($this->post->post_type);
414
 
415
+ // Managed Post Type page?
416
+ if ( $this->listing_repo->isAssignedPostType($this->post->id, $this->assigned_pt_pages) ) $row_parent_classes .= ' is-page-assignment';
417
 
418
  // Published?
419
+ if ( $this->post->status == 'publish' ) $row_parent_classes .= ' published';
420
+ if ( $this->post->status == 'draft' ) $row_parent_classes .= ' draft';
421
+
422
  // Hidden in Nested Pages?
423
+ if ( $this->post->np_status == 'hide' ) $row_parent_classes .= ' np-hide';
424
 
425
  // User Status Preference
426
+ if ( $this->status_preference == 'published' && $this->post->status == 'draft' ) $row_parent_classes .= ' np-hide';
427
+ if ( $this->status_preference == 'draft' && $this->post->status !== 'draft' ) $row_parent_classes .= ' np-hide';
428
 
429
  // Taxonomies
430
+ $row_parent_classes .= ' ' . $this->post_repo->getTaxonomyCSS($this->post, $this->h_taxonomies, $this->f_taxonomies);
431
+
432
+ echo '<li id="menuItem_' . esc_attr($this->post->id) . '" class="' . apply_filters('nestedpages_row_parent_css_classes', $row_parent_classes, $this->post, $this->post_type) . '">';
433
 
434
  $count++;
435
 
app/Entities/NavMenu/NavMenuFrontEnd.php CHANGED
@@ -17,7 +17,6 @@ class NavMenuFrontEnd
17
  {
18
  $this->nav_menu_repo = new NavMenuRepository;
19
  add_filter('nav_menu_link_attributes', [$this, 'attributeFilter'], 10, 3);
20
- add_filter('nav_menu_item_args', [$this, 'removePrivateItems'], 10, 3);
21
  }
22
 
23
  /**
@@ -25,6 +24,9 @@ class NavMenuFrontEnd
25
  */
26
  public function attributeFilter($atts, $item, $args)
27
  {
 
 
 
28
  if ( $this->nav_menu_repo->getMenuID() == null ) return $atts;
29
  if ( !isset($args->menu->term_id) ) return $atts;
30
  if ( $args->menu->term_id !== $this->nav_menu_repo->getMenuID() ) return $atts;
@@ -38,14 +40,4 @@ class NavMenuFrontEnd
38
 
39
  return $atts;
40
  }
41
-
42
- /**
43
- * Remove Private Items from the menu
44
- */
45
- public function removePrivateItems($args, $item, $depth)
46
- {
47
- // $status = get_post_status($item->object_id);
48
- // if ( $status && $status == 'private' ) $item->post_status = 'private';
49
- return $args;
50
- }
51
  }
17
  {
18
  $this->nav_menu_repo = new NavMenuRepository;
19
  add_filter('nav_menu_link_attributes', [$this, 'attributeFilter'], 10, 3);
 
20
  }
21
 
22
  /**
24
  */
25
  public function attributeFilter($atts, $item, $args)
26
  {
27
+ if ( get_option('nestedpages_menusync') !== 'sync' ) return $atts;
28
+ if ( get_option('nestedpages_disable_menu') == 'true' ) return $atts;
29
+
30
  if ( $this->nav_menu_repo->getMenuID() == null ) return $atts;
31
  if ( !isset($args->menu->term_id) ) return $atts;
32
  if ( $args->menu->term_id !== $this->nav_menu_repo->getMenuID() ) return $atts;
40
 
41
  return $atts;
42
  }
 
 
 
 
 
 
 
 
 
 
43
  }
app/Entities/NavMenu/NavMenuRepository.php CHANGED
@@ -34,6 +34,14 @@ class NavMenuRepository
34
  return ( $post_id ) ? $post_id : 0;
35
  }
36
 
 
 
 
 
 
 
 
 
37
  if ( $query == 'object_id' ){
38
  $menu_id = $this->getMenuID();
39
  $prefix = $wpdb->prefix;
34
  return ( $post_id ) ? $post_id : 0;
35
  }
36
 
37
+ if ( $query == 'description' ){
38
+ $prefix = $wpdb->prefix;
39
+ $post_table = $prefix . 'posts';
40
+ $sql = "SELECT post_content FROM `$post_table` WHERE ID = '$id'";
41
+ $description = $wpdb->get_var($sql);
42
+ return ( $description ) ? $description : ' ';
43
+ }
44
+
45
  if ( $query == 'object_id' ){
46
  $menu_id = $this->getMenuID();
47
  $prefix = $wpdb->prefix;
app/Entities/NavMenu/NavMenuSyncListing.php CHANGED
@@ -121,7 +121,7 @@ class NavMenuSyncListing extends NavMenuSync
121
  'menu-item-parent-id' => $menu_parent,
122
  'menu-item-xfn' => $xfn,
123
  'menu-item-target' => $this->post->link_target,
124
- 'menu-item-description' => ' '
125
  ];
126
  $menu = wp_update_nav_menu_item($this->id, $menu_item_id, $args);
127
  return $menu;
121
  'menu-item-parent-id' => $menu_parent,
122
  'menu-item-xfn' => $xfn,
123
  'menu-item-target' => $this->post->link_target,
124
+ 'menu-item-description' => $this->nav_menu_repo->getMenuItem($menu_item_id, 'description')
125
  ];
126
  $menu = wp_update_nav_menu_item($this->id, $menu_item_id, $args);
127
  return $menu;
app/Entities/Post/PostFactory.php CHANGED
@@ -61,6 +61,7 @@ class PostFactory
61
  'post_type' => $post_type,
62
  'menu_order' => $menu_order
63
  ];
 
64
  $new_page_id = wp_insert_post($post);
65
  $data['post_id'] = $new_page_id;
66
  if ( isset($data['page_template']) ) $this->post_update_repo->updateTemplate($data);
61
  'post_type' => $post_type,
62
  'menu_order' => $menu_order
63
  ];
64
+ $post = apply_filters('nestedpages_new_post', $post, $data);
65
  $new_page_id = wp_insert_post($post);
66
  $data['post_id'] = $new_page_id;
67
  if ( isset($data['page_template']) ) $this->post_update_repo->updateTemplate($data);
app/FrontEndBootstrap.php CHANGED
@@ -10,7 +10,6 @@ class FrontEndBootstrap
10
 
11
  public function init()
12
  {
13
- // new RedirectsFrontEnd;
14
  new Entities\NavMenu\NavMenuFrontEnd;
15
  }
16
  }
10
 
11
  public function init()
12
  {
 
13
  new Entities\NavMenu\NavMenuFrontEnd;
14
  }
15
  }
app/NestedPages.php CHANGED
@@ -12,7 +12,7 @@ class NestedPages
12
  $np_env = 'live';
13
 
14
  global $np_version;
15
- $np_version = '3.1.19';
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.20';
16
 
17
  if ( is_admin() ) $app = new NestedPages\Bootstrap;
18
  if ( !is_admin() ) $app = new NestedPages\FrontEndBootstrap;
app/Views/forms/clone-form.php CHANGED
@@ -39,7 +39,7 @@
39
  if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
40
  $users_opt = [
41
  'hide_if_only_one_author' => false,
42
- 'who' => 'authors',
43
  'name' => 'post_author',
44
  'id' => 'post_author',
45
  'class'=> 'authors',
39
  if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
40
  $users_opt = [
41
  'hide_if_only_one_author' => false,
42
+ 'capability' => 'edit_posts',
43
  'name' => 'post_author',
44
  'id' => 'post_author',
45
  'class'=> 'authors',
app/Views/forms/new-child.php CHANGED
@@ -49,7 +49,7 @@
49
  if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
50
  $users_opt = [
51
  'hide_if_only_one_author' => false,
52
- 'who' => 'authors',
53
  'name' => 'post_author',
54
  'id' => 'post_author',
55
  'class'=> 'authors',
49
  if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
50
  $users_opt = [
51
  'hide_if_only_one_author' => false,
52
+ 'capability' => 'edit_posts',
53
  'name' => 'post_author',
54
  'id' => 'post_author',
55
  'class'=> 'authors',
app/Views/forms/quickedit-post.php CHANGED
@@ -83,7 +83,7 @@ $has_menu_options = ( $this->user->canSortPosts($this->post_type->name) && $this
83
  if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
84
  $users_opt = [
85
  'hide_if_only_one_author' => false,
86
- 'who' => 'authors',
87
  'name' => 'post_author',
88
  'id' => 'post_author',
89
  'class'=> 'authors',
83
  if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
84
  $users_opt = [
85
  'hide_if_only_one_author' => false,
86
+ 'capability' => 'edit_posts',
87
  'name' => 'post_author',
88
  'id' => 'post_author',
89
  'class'=> 'authors',
app/Views/partials/bulk-edit.php CHANGED
@@ -27,7 +27,7 @@ $has_menu_options = ( $this->user->canSortPosts($this->post_type->name) && $this
27
  $users_opt = [
28
  'show_option_none' => '&mdash; ' . __('No Change', 'wp-nested-pages') . ' &mdash;',
29
  'hide_if_only_one_author' => false,
30
- 'who' => 'authors',
31
  'name' => 'post_author',
32
  'id' => 'post_author',
33
  'class'=> 'authors',
27
  $users_opt = [
28
  'show_option_none' => '&mdash; ' . __('No Change', 'wp-nested-pages') . ' &mdash;',
29
  'hide_if_only_one_author' => false,
30
+ 'capability' => 'edit_posts',
31
  'name' => 'post_author',
32
  'id' => 'post_author',
33
  'class'=> 'authors',
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.19
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.20
7
  Author: Kyle Phillips
8
  Author URI: https://github.com/kylephillips
9
  Text Domain: wp-nested-pages
readme.txt CHANGED
@@ -5,7 +5,7 @@ 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.18
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -105,6 +105,12 @@ No. The menu synchronization currently only works within the pages post type.
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
108
  = 3.1.19 =
109
  * Fixes dragging/sorting bug introduced in WordPress version 5.9.
110
 
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
 
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
111
+ * Adds 'nestedpages_row_parent_css_classes' developer filter for filtering css classes output in each row's parent <li> element
112
+ * Adds 'nestedpages_new_post' developer filter for filtering new posts before they are added (through child pages or through the "Add Multiple" interface)
113
+
114
  = 3.1.19 =
115
  * Fixes dragging/sorting bug introduced in WordPress version 5.9.
116