CMS Tree Page View - Version 1.2.24

Version Description

  • Fix problems with users not gettng permissions to move pages.
Download this release

Release Info

Developer eskapism
Plugin Icon wp plugin CMS Tree Page View
Version 1.2.24
Comparing to
See all releases

Code changes from version 1.2.23 to 1.2.24

Files changed (3) hide show
  1. functions.php +26 -11
  2. index.php +3 -3
  3. readme.txt +4 -1
functions.php CHANGED
@@ -1785,6 +1785,10 @@ function cms_tpv_install() {
1785
  // set to current version
1786
  update_option('cms_tpv_version', CMS_TPV_VERSION);
1787
 
 
 
 
 
1788
  // Add necessary capabilities to allow moving tree of cms_tpv
1789
  $roles = array(
1790
  'administrator' => array(CMS_TPV_MOVE_PERMISSION),
@@ -1800,15 +1804,17 @@ function cms_tpv_install() {
1800
  }
1801
 
1802
  function cms_tpv_uninstall() {
1803
- // Remove capabilities to disallow moving tree of cms_tpv
1804
- $roles = array(
1805
- 'administrator' => array(CMS_TPV_MOVE_PERMISSION),
1806
- 'editor' => array(CMS_TPV_MOVE_PERMISSION)
1807
- );
1808
 
1809
- foreach ( $roles as $role => $caps ) {
1810
- remove_caps_from_role( $role, $caps );
1811
- }
 
 
 
 
 
 
 
1812
  }
1813
 
1814
  /**
@@ -1883,14 +1889,23 @@ function cms_tpv_setup_defaults() {
1883
  * if not = it's an upgrade. right?
1884
  */
1885
  function cms_tpv_plugins_loaded($a) {
 
1886
  $installed_version = get_option('cms_tpv_version', 0);
1887
- #echo "installed_version: $installed_version";
1888
- #echo "<br>" . CMS_TPV_VERSION;
 
 
1889
  if ($installed_version != CMS_TPV_VERSION) {
 
1890
  // new version!
1891
- // upgrade stored version to current version + show that annoying litte box again
1892
  update_option('cms_tpv_version', CMS_TPV_VERSION);
 
 
1893
  update_option('cms_tpv_show_annoying_little_box', 1);
 
 
 
1894
  }
1895
 
1896
  }
1785
  // set to current version
1786
  update_option('cms_tpv_version', CMS_TPV_VERSION);
1787
 
1788
+ }
1789
+
1790
+ function cms_tvp_setup_caps() {
1791
+
1792
  // Add necessary capabilities to allow moving tree of cms_tpv
1793
  $roles = array(
1794
  'administrator' => array(CMS_TPV_MOVE_PERMISSION),
1804
  }
1805
 
1806
  function cms_tpv_uninstall() {
 
 
 
 
 
1807
 
1808
+ // Remove capabilities to disallow moving tree of cms_tpv
1809
+ $roles = array(
1810
+ 'administrator' => array(CMS_TPV_MOVE_PERMISSION),
1811
+ 'editor' => array(CMS_TPV_MOVE_PERMISSION)
1812
+ );
1813
+
1814
+ foreach ( $roles as $role => $caps ) {
1815
+ remove_caps_from_role( $role, $caps );
1816
+ }
1817
+
1818
  }
1819
 
1820
  /**
1889
  * if not = it's an upgrade. right?
1890
  */
1891
  function cms_tpv_plugins_loaded($a) {
1892
+
1893
  $installed_version = get_option('cms_tpv_version', 0);
1894
+
1895
+ //echo "installed_version in options table: $installed_version";
1896
+ //echo "<br>version according to this file" . CMS_TPV_VERSION;
1897
+
1898
  if ($installed_version != CMS_TPV_VERSION) {
1899
+
1900
  // new version!
1901
+ // upgrade stored version to current version
1902
  update_option('cms_tpv_version', CMS_TPV_VERSION);
1903
+
1904
+ // show that annoying litte box again
1905
  update_option('cms_tpv_show_annoying_little_box', 1);
1906
+
1907
+ // setup caps/persmissions
1908
+ cms_tvp_setup_caps();
1909
  }
1910
 
1911
  }
index.php CHANGED
@@ -27,7 +27,7 @@ License: GPL2
27
 
28
  #require("functions.php");
29
 
30
- define( "CMS_TPV_VERSION", "1.2.23");
31
  define( "CMS_TPV_NAME", "CMS Tree Page View");
32
 
33
  require(dirname(__FILE__) . "/functions.php");
@@ -75,8 +75,8 @@ register_uninstall_hook( WP_PLUGIN_DIR . "/cms-tree-page-view/index.php" , 'cms_
75
  // To test activation hook, uncomment function below
76
  // cms_tpv_install();
77
 
78
- // catch upgrade
79
- add_action('plugins_loaded', 'cms_tpv_plugins_loaded' , 1);
80
 
81
  // hook onto query
82
  #add_action( 'parse_query', 'cms_tpv_parse_query' );
27
 
28
  #require("functions.php");
29
 
30
+ define( "CMS_TPV_VERSION", "1.2.24");
31
  define( "CMS_TPV_NAME", "CMS Tree Page View");
32
 
33
  require(dirname(__FILE__) . "/functions.php");
75
  // To test activation hook, uncomment function below
76
  // cms_tpv_install();
77
 
78
+ // catch upgrade. moved from plugins_loaded to init to be able to use wp_roles
79
+ add_action('init', 'cms_tpv_plugins_loaded' , 1);
80
 
81
  // hook onto query
82
  #add_action( 'parse_query', 'cms_tpv_parse_query' );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: page, pages, posts, custom posts, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
5
  Requires at least: 3.8
6
  Tested up to: 3.9
7
- Stable tag: 1.2.23
8
 
9
  Adds a tree view of all pages & custom posts. Get a great overview + options to drag & drop to reorder & option to add multiple pages.
10
 
@@ -113,6 +113,9 @@ Now the tree with the pages will be visible both on the dashboard and in the men
113
 
114
  == Changelog ==
115
 
 
 
 
116
  = 1.2.23 =
117
  - Now only users with permission may move pages and custom posts and publish new posts. By default administrator and editors have these rights. Is checked using capability "move_cms_tree_view_page", so add that to any user you want to allow this for. Props mateuszdw, who made [the very first pull request for this plugin](https://github.com/bonny/WordPress-CMS-Tree-Page-View/pull/1)! Thanks a lot!
118
 
4
  Tags: page, pages, posts, custom posts, tree, cms, dashboard, overview, drag-and-drop, rearrange, management, manage, admin
5
  Requires at least: 3.8
6
  Tested up to: 3.9
7
+ Stable tag: 1.2.24
8
 
9
  Adds a tree view of all pages & custom posts. Get a great overview + options to drag & drop to reorder & option to add multiple pages.
10
 
113
 
114
  == Changelog ==
115
 
116
+ = 1.2.24 =
117
+ - Fix problems with users not gettng permissions to move pages.
118
+
119
  = 1.2.23 =
120
  - Now only users with permission may move pages and custom posts and publish new posts. By default administrator and editors have these rights. Is checked using capability "move_cms_tree_view_page", so add that to any user you want to allow this for. Props mateuszdw, who made [the very first pull request for this plugin](https://github.com/bonny/WordPress-CMS-Tree-Page-View/pull/1)! Thanks a lot!
121