Post Types Order - Version 1.4.3

Version Description

  • Small improvments
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 Post Types Order
Version 1.4.3
Comparing to
See all releases

Code changes from version 1.3.9 to 1.4.3

Files changed (2) hide show
  1. post-types-order.php +35 -28
  2. readme.txt +8 -2
post-types-order.php CHANGED
@@ -5,13 +5,12 @@ Plugin URI: http://www.nsp-code.com
5
  Description: Order Post Types Objects using a Drag and Drop Sortable javascript capability
6
  Author: NSP CODE
7
  Author URI: http://www.nsp-code.com
8
- Version: 1.3.9
9
  */
10
 
11
  define('CPTPATH', ABSPATH.'wp-content/plugins/post-types-order');
12
  define('CPTURL', get_option('siteurl').'/wp-content/plugins/post-types-order');
13
 
14
-
15
  register_deactivation_hook(__FILE__, 'CPTO_deactivated');
16
  register_activation_hook(__FILE__, 'CPTO_activated');
17
 
@@ -25,6 +24,9 @@ function CPTO_activated()
25
  if (!isset($options['adminsort']))
26
  $options['adminsort'] = '1';
27
 
 
 
 
28
  update_option('cpto_options', $options);
29
  }
30
 
@@ -32,6 +34,8 @@ function CPTO_deactivated()
32
  {
33
 
34
  }
 
 
35
 
36
  add_filter('pre_get_posts', 'CPTO_pre_get_posts');
37
  function CPTO_pre_get_posts($query)
@@ -78,13 +82,23 @@ function CPTOrderPosts($orderBy)
78
  return($orderBy);
79
  }
80
 
 
 
 
81
 
82
- add_action('wp_loaded', 'initCPTO' );
83
- add_action('admin_menu', 'cpto_plugin_menu');
84
-
85
- add_action( 'plugins_loaded', 'cpto_load_textdomain', 2 );
 
 
 
 
 
 
86
 
87
 
 
88
  function cpto_load_textdomain()
89
  {
90
  $locale = get_locale();
@@ -94,13 +108,15 @@ function cpto_load_textdomain()
94
  }
95
  }
96
 
97
-
98
  function cpto_plugin_menu()
99
  {
100
  include (CPTPATH . '/include/options.php');
101
  add_options_page('Post Types Order', '<img class="menu_pto" src="'. CPTURL .'/images/menu-icon.gif" alt="" />Post Types Order', 'manage_options', 'cpto-options', 'cpt_plugin_options');
102
  }
103
-
 
 
104
  function initCPTO()
105
  {
106
  global $custom_post_type_order, $userdata;
@@ -114,6 +130,10 @@ function initCPTO()
114
  if (userdata_get_user_level() >= $options['level'])
115
  $custom_post_type_order = new CPTO();
116
  }
 
 
 
 
117
  }
118
  }
119
 
@@ -234,7 +254,10 @@ class CPTO
234
  if ($post_type_name == 'post')
235
  add_submenu_page('edit.php', 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
236
  else
237
- add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
 
 
 
238
  }
239
  }
240
 
@@ -246,6 +269,8 @@ class CPTO
246
  <div class="icon32" id="icon-edit"><br></div>
247
  <h2><?php echo $this->current_post_type->labels->singular_name . ' - Re-order '?></h2>
248
 
 
 
249
  <div id="ajax-response"></div>
250
 
251
  <noscript>
@@ -271,7 +296,6 @@ class CPTO
271
  jQuery("#sortable").sortable({
272
  'tolerance':'intersect',
273
  'cursor':'pointer',
274
- 'grid': [50, 10],
275
  'items':'li',
276
  'placeholder':'placeholder',
277
  'nested': 'ul'
@@ -353,23 +377,6 @@ class CPTO
353
  return call_user_func_array(array(&$walker, 'walk'), $args);
354
  }
355
  }
356
-
357
-
358
-
359
- function userdata_get_user_level()
360
- {
361
- global $userdata;
362
-
363
- $user_level = '';
364
- for ($i=10; $i >= 0;$i--)
365
- {
366
- if (current_user_can('level_' . $i) === TRUE)
367
- {
368
- $user_level = $i;
369
- break;
370
- }
371
- }
372
- return ($user_level);
373
- }
374
 
375
  ?>
5
  Description: Order Post Types Objects using a Drag and Drop Sortable javascript capability
6
  Author: NSP CODE
7
  Author URI: http://www.nsp-code.com
8
+ Version: 1.4.3
9
  */
10
 
11
  define('CPTPATH', ABSPATH.'wp-content/plugins/post-types-order');
12
  define('CPTURL', get_option('siteurl').'/wp-content/plugins/post-types-order');
13
 
 
14
  register_deactivation_hook(__FILE__, 'CPTO_deactivated');
15
  register_activation_hook(__FILE__, 'CPTO_activated');
16
 
24
  if (!isset($options['adminsort']))
25
  $options['adminsort'] = '1';
26
 
27
+ if (!isset($options['level']))
28
+ $options['level'] = 0;
29
+
30
  update_option('cpto_options', $options);
31
  }
32
 
34
  {
35
 
36
  }
37
+
38
+ include_once(CPTPATH . '/include/functions.php');
39
 
40
  add_filter('pre_get_posts', 'CPTO_pre_get_posts');
41
  function CPTO_pre_get_posts($query)
82
  return($orderBy);
83
  }
84
 
85
+ $is_configured = get_option('CPT_configured');
86
+ if ($is_configured == '')
87
+ add_action( 'admin_notices', 'CPTO_admin_notices');
88
 
89
+ function CPTO_admin_notices()
90
+ {
91
+ if (isset($_POST['form_submit']))
92
+ return;
93
+ ?>
94
+ <div class="error fade">
95
+ <p><strong>Post Types Order must be configured. Please go to <a href="<?php echo get_admin_url() ?>options-general.php?page=cpto-options">Settings Page</a> make the configuration and save</strong></p>
96
+ </div>
97
+ <?php
98
+ }
99
 
100
 
101
+ add_action( 'plugins_loaded', 'cpto_load_textdomain', 2 );
102
  function cpto_load_textdomain()
103
  {
104
  $locale = get_locale();
108
  }
109
  }
110
 
111
+ add_action('admin_menu', 'cpto_plugin_menu');
112
  function cpto_plugin_menu()
113
  {
114
  include (CPTPATH . '/include/options.php');
115
  add_options_page('Post Types Order', '<img class="menu_pto" src="'. CPTURL .'/images/menu-icon.gif" alt="" />Post Types Order', 'manage_options', 'cpto-options', 'cpt_plugin_options');
116
  }
117
+
118
+
119
+ add_action('wp_loaded', 'initCPTO' );
120
  function initCPTO()
121
  {
122
  global $custom_post_type_order, $userdata;
130
  if (userdata_get_user_level() >= $options['level'])
131
  $custom_post_type_order = new CPTO();
132
  }
133
+ else
134
+ {
135
+ $custom_post_type_order = new CPTO();
136
+ }
137
  }
138
  }
139
 
254
  if ($post_type_name == 'post')
255
  add_submenu_page('edit.php', 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
256
  else
257
+ {
258
+ if (!is_post_type_hierarchical($post_type_name))
259
+ add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
260
+ }
261
  }
262
  }
263
 
269
  <div class="icon32" id="icon-edit"><br></div>
270
  <h2><?php echo $this->current_post_type->labels->singular_name . ' - Re-order '?></h2>
271
 
272
+ <?php cpt_info_box(); ?>
273
+
274
  <div id="ajax-response"></div>
275
 
276
  <noscript>
296
  jQuery("#sortable").sortable({
297
  'tolerance':'intersect',
298
  'cursor':'pointer',
 
299
  'items':'li',
300
  'placeholder':'placeholder',
301
  'nested': 'ul'
377
  return call_user_func_array(array(&$walker, 'walk'), $args);
378
  }
379
  }
380
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
 
382
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Nsp Code
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post type order, custom post type order, post types order, page order, post order, admin post order, post types sort, post type sort, admin custom post order, custom order, ajax, re-order, drag-and-drop, admin, manage, custom, post, custom type, post type, order, ordering, sort, post, page
5
  Requires at least: 2.8
6
- Tested up to: 3.0.4
7
- Stable tag: 1.3.9
8
 
9
  Order Post Types Objects (posts, pages, custom post types) using a Drag and Drop Sortable javascript capability
10
 
@@ -47,6 +47,12 @@ All ideas are welcome and i put them on my list to be implemented into the new v
47
 
48
  == Change Log ==
49
 
 
 
 
 
 
 
50
  = 1.3.9 =
51
  - Re-Order Menu Item Appearance fix
52
 
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post type order, custom post type order, post types order, page order, post order, admin post order, post types sort, post type sort, admin custom post order, custom order, ajax, re-order, drag-and-drop, admin, manage, custom, post, custom type, post type, order, ordering, sort, post, page
5
  Requires at least: 2.8
6
+ Tested up to: 3.1
7
+ Stable tag: 1.4.3
8
 
9
  Order Post Types Objects (posts, pages, custom post types) using a Drag and Drop Sortable javascript capability
10
 
47
 
48
  == Change Log ==
49
 
50
+ = 1.4.3 =
51
+ - Small improvments
52
+
53
+ = 1.4.1 =
54
+ - Re-Order Menu Item Appearance fix for update versions
55
+
56
  = 1.3.9 =
57
  - Re-Order Menu Item Appearance fix
58