Admin Menu Tree Page View - Version 2.6.5

Version Description

  • Fixed a bug that caused errors when bulk editing posts
Download this release

Release Info

Developer eskapism
Plugin Icon wp plugin Admin Menu Tree Page View
Version 2.6.5
Comparing to
See all releases

Code changes from version 2.6.4 to 2.6.5

Files changed (2) hide show
  1. index.php +17 -6
  2. readme.txt +4 -1
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Admin Menu Tree Page View
4
  Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
5
  Description: Get a tree view of all your pages directly in the admin menu. Search, edit, view and add pages - all with just one click away!
6
- Version: 2.6.4
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -38,7 +38,7 @@ add_action('wp_ajax_admin_menu_tree_page_view_move_page', 'admin_menu_tree_page_
38
 
39
  function admin_menu_tree_page_view_admin_init() {
40
 
41
- define( "admin_menu_tree_page_view_VERSION", "2.6.4" );
42
  define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
43
  define( "admin_menu_tree_page_view_DIR", WP_PLUGIN_DIR . '/admin-menu-tree-page-view/' );
44
 
@@ -106,12 +106,17 @@ class admin_menu_tree_page_view {
106
  }
107
 
108
  static function get_post_ancestors($post_to_check_parents_for) {
109
- if (!isset(admin_menu_tree_page_view::$one_page_parents)) {
 
 
110
  wp_cache_delete($post_to_check_parents_for, 'posts');
111
  $one_page_parents = get_post_ancestors($post_to_check_parents_for);
112
  admin_menu_tree_page_view::$one_page_parents = $one_page_parents;
 
113
  }
 
114
  return admin_menu_tree_page_view::$one_page_parents;
 
115
  }
116
 
117
  }
@@ -194,10 +199,14 @@ function admin_menu_tree_page_view_get_pages($args) {
194
  $cookie_opened = explode(",", $cookie_opened);
195
 
196
  // if we are editing a post, we should see it in the tree, right?
197
- if ( isset($_GET["action"]) && "edit" == $_GET["action"] && isset($_GET["post"])) {
 
 
198
  // if post with id get[post] is a parent of the current post, show it
199
- if ($_GET["post"] != $one_page->ID) {
 
200
  $post_to_check_parents_for = $_GET["post"];
 
201
  // seems to be a problem with get_post_ancestors (yes, it's in the trac too)
202
  // Long time since I wrote this, but perhaps this is the problem (adding for future reference):
203
  // http://core.trac.wordpress.org/ticket/10381
@@ -208,7 +217,9 @@ function admin_menu_tree_page_view_get_pages($args) {
208
  if (in_array($one_page->ID, $one_page_parents)) {
209
  $isOpened = TRUE;
210
  }
 
211
  }
 
212
  }
213
 
214
  if (in_array($one_page->ID, $cookie_opened) || $isOpened && $post_children_count>0) {
@@ -305,7 +316,7 @@ function admin_menu_tree_page_view_admin_menu() {
305
  );
306
 
307
  $output .= admin_menu_tree_page_view_get_pages($args);
308
-
309
  // end our ul and add the a-tag that wp automatically will close
310
  $output .= "
311
  </ul>
3
  Plugin Name: Admin Menu Tree Page View
4
  Plugin URI: http://eskapism.se/code-playground/admin-menu-tree-page-view/
5
  Description: Get a tree view of all your pages directly in the admin menu. Search, edit, view and add pages - all with just one click away!
6
+ Version: 2.6.5
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
38
 
39
  function admin_menu_tree_page_view_admin_init() {
40
 
41
+ define( "admin_menu_tree_page_view_VERSION", "2.6.5" );
42
  define( "admin_menu_tree_page_view_URL", WP_PLUGIN_URL . '/admin-menu-tree-page-view/' );
43
  define( "admin_menu_tree_page_view_DIR", WP_PLUGIN_DIR . '/admin-menu-tree-page-view/' );
44
 
106
  }
107
 
108
  static function get_post_ancestors($post_to_check_parents_for) {
109
+
110
+ if ( ! isset(admin_menu_tree_page_view::$one_page_parents) ) {
111
+
112
  wp_cache_delete($post_to_check_parents_for, 'posts');
113
  $one_page_parents = get_post_ancestors($post_to_check_parents_for);
114
  admin_menu_tree_page_view::$one_page_parents = $one_page_parents;
115
+
116
  }
117
+
118
  return admin_menu_tree_page_view::$one_page_parents;
119
+
120
  }
121
 
122
  }
199
  $cookie_opened = explode(",", $cookie_opened);
200
 
201
  // if we are editing a post, we should see it in the tree, right?
202
+ // don't use on bulk edit, then post is an array and not a single post id
203
+ if ( isset($_GET["action"]) && "edit" == $_GET["action"] && isset($_GET["post"]) && is_integer($_GET["post"]) ) {
204
+
205
  // if post with id get[post] is a parent of the current post, show it
206
+ if ( $_GET["post"] != $one_page->ID ) {
207
+
208
  $post_to_check_parents_for = $_GET["post"];
209
+
210
  // seems to be a problem with get_post_ancestors (yes, it's in the trac too)
211
  // Long time since I wrote this, but perhaps this is the problem (adding for future reference):
212
  // http://core.trac.wordpress.org/ticket/10381
217
  if (in_array($one_page->ID, $one_page_parents)) {
218
  $isOpened = TRUE;
219
  }
220
+
221
  }
222
+
223
  }
224
 
225
  if (in_array($one_page->ID, $cookie_opened) || $isOpened && $post_children_count>0) {
316
  );
317
 
318
  $output .= admin_menu_tree_page_view_get_pages($args);
319
+
320
  // end our ul and add the a-tag that wp automatically will close
321
  $output .= "
322
  </ul>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: admin, page, pages, page tree, hierarchy, cms, tree, view, admin menu, menu, change order, drag and drop
5
  Requires at least: 3.0
6
  Tested up to: 3.5.1
7
- Stable tag: 2.6.4
8
 
9
  Get a tree view of all your pages directly in the admin menu. Search, edit, view, re-order/sort and add pages – all is just one click away!
10
 
@@ -50,6 +50,9 @@ Now the tree with the pages will be visible in the admin menu to the left.
50
 
51
  == Changelog ==
52
 
 
 
 
53
  = 2.6.4 =
54
  - Added Italian translation. Thanks!
55
 
4
  Tags: admin, page, pages, page tree, hierarchy, cms, tree, view, admin menu, menu, change order, drag and drop
5
  Requires at least: 3.0
6
  Tested up to: 3.5.1
7
+ Stable tag: 2.6.5
8
 
9
  Get a tree view of all your pages directly in the admin menu. Search, edit, view, re-order/sort and add pages – all is just one click away!
10
 
50
 
51
  == Changelog ==
52
 
53
+ = 2.6.5 =
54
+ - Fixed a bug that caused errors when bulk editing posts
55
+
56
  = 2.6.4 =
57
  - Added Italian translation. Thanks!
58