Post Types Order - Version 1.5.7

Version Description

  • Updates/Fixes
    • Using Capabilities instead levels
    • Updating certain code for WordPress 3.5 compatibility
    • Set default order as seccondary query order param
Download this release

Release Info

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

Code changes from version 1.5.4 to 1.5.7

css/cpt.css CHANGED
@@ -1,7 +1,7 @@
1
  #sortable { list-style-type: none; margin: 10px 0 0; padding: 0; width: 100%; }
2
  #sortable ul { margin-left:20px; list-style: none; }
3
- #sortable li { padding: 2px 0px; margin: 4px 0px; border: 1px solid #DDDDDD; cursor: move; -moz-border-radius:6px}
4
- #sortable li span { display: block; background: #f7f7f7; padding: 5px; color:#808080; font-size: font-size:14px; font-weight:bold;}
5
  #sortable li.placeholder{border: dashed 2px #ccc;background-color:#FFF;height:20px;}
6
 
7
  #icon-settings {background-image:url("../images/admin-icon-settings.gif");background-repeat:no-repeat;}
@@ -10,12 +10,12 @@ h2.subtitle {font-size: 15px; font-style: italic; font-weight: bold}
10
 
11
  #cpt_info_box {padding: 0 10px; border: 1px dashed #21759B; background-color: #F1F1F1}
12
  #cpt_info_box p {font-size: 12px}
13
- #cpt_info_box #donate_form {float: right; padding: 10px 0 10px 10px}
14
 
15
  .menu_pto {margin-bottom: -2px; display: inline; padding-right: 2px}
16
 
17
- #p_right {float: right; width: 200px; }
18
- .p_s_item {float: left; padding: 0px 5px; margin-top: 15px; margin-bottom: 5px}
19
- .p_s_item.s_gp {padding-top: 2px; margin-left: 10px}
20
 
21
  .clear {clear: both}
1
  #sortable { list-style-type: none; margin: 10px 0 0; padding: 0; width: 100%; }
2
  #sortable ul { margin-left:20px; list-style: none; }
3
+ #sortable li { padding: 2px 0px; margin: 4px 0px; border: 1px solid #DDDDDD; cursor: move; -moz-border-radius:6px;}
4
+ #sortable li span { display: block; background: #f7f7f7; padding: 5px 10px; color:#808080; font-size:13px; font-weight:bold;}
5
  #sortable li.placeholder{border: dashed 2px #ccc;background-color:#FFF;height:20px;}
6
 
7
  #icon-settings {background-image:url("../images/admin-icon-settings.gif");background-repeat:no-repeat;}
10
 
11
  #cpt_info_box {padding: 0 10px; border: 1px dashed #21759B; background-color: #F1F1F1}
12
  #cpt_info_box p {font-size: 12px}
13
+ #cpt_info_box #donate_form {float: right; padding: 5px 0 10px 10px}
14
 
15
  .menu_pto {margin-bottom: -2px; display: inline; padding-right: 2px}
16
 
17
+ #p_right {float: right; width: 210px; }
18
+ .p_s_item {float: right; padding: 0px 5px; margin-top: 15px; margin-bottom: 5px}
19
+ .p_s_item.s_gp {padding-top: 2px; margin-left: 5px}
20
 
21
  .clear {clear: both}
include/functions.php CHANGED
@@ -1,5 +1,13 @@
1
  <?php
2
 
 
 
 
 
 
 
 
 
3
  function userdata_get_user_level($return_as_numeric = FALSE)
4
  {
5
  global $userdata;
@@ -34,7 +42,7 @@
34
  <div class="g-plusone" data-size="small" data-annotation="none" data-href="http://nsp-code.com/"></div>
35
  </div>
36
  <div class="p_s_item s_t">
37
- <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.nsp-code.com" data-text="Define custom order for your taxonomies terms through an easy to use javascript AJAX drag and drop interface. No theme code updates are necessarily, this plugin will take care of query update." data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
38
  </div>
39
 
40
  <div class="p_s_item s_f">
@@ -54,9 +62,9 @@
54
  </div>
55
  </div>
56
 
57
- <p>Did you found useful this plug-in? Please support our work with a donation or write an article about this plugin in your blog with a link to our site <strong>http://www.nsp-code.com/</strong>.</p>
58
- <h4>Did you know there is available an Advanced version of this plug-in? <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/">Read more</a></h4>
59
- <p>Check our <a target="_blank" href="http://wordpress.org/extend/plugins/taxonomy-terms-order/">Category Order - Taxonomy Terms Order</a> plugin which allow to custom sort all categories and custom taxonomies terms </p>
60
  </div>
61
 
62
  <?php
1
  <?php
2
 
3
+
4
+ /**
5
+ * Return the user level
6
+ *
7
+ * This is deprecated, will be removed in the next versions
8
+ *
9
+ * @param mixed $return_as_numeric
10
+ */
11
  function userdata_get_user_level($return_as_numeric = FALSE)
12
  {
13
  global $userdata;
42
  <div class="g-plusone" data-size="small" data-annotation="none" data-href="http://nsp-code.com/"></div>
43
  </div>
44
  <div class="p_s_item s_t">
45
+ <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.nsp-code.com" data-text="Define custom order for your post types through an easy to use javascript AJAX drag and drop interface. No theme code updates are necessarily, this plugin will take care of query update." data-count="none">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
46
  </div>
47
 
48
  <div class="p_s_item s_f">
62
  </div>
63
  </div>
64
 
65
+ <p><?php _e('Did you find this plugin useful? Please support our work with a donation or write an article about this plugin in your blog with a link to our site', 'cpt') ?> <strong>http://www.nsp-code.com/</strong>.</p>
66
+ <h4><?php _e('Did you know there is available an Advanced version of this plug-in?', 'cpt') ?> <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/"><?php _e('Read more', 'cpt') ?></a></h4>
67
+ <p><?php _e('Check our', 'cpt') ?> <a target="_blank" href="http://wordpress.org/extend/plugins/taxonomy-terms-order/">Category Order - Taxonomy Terms Order</a> <?php _e('plugin which allow to custom sort categories and custom taxonomies terms', 'cpt') ?> </p>
68
  </div>
69
 
70
  <?php
include/options.php CHANGED
@@ -8,7 +8,7 @@ function cpt_plugin_options()
8
  if (isset($_POST['form_submit']))
9
  {
10
 
11
- $options['level'] = $_POST['level'];
12
 
13
  $options['autosort'] = isset($_POST['autosort']) ? $_POST['autosort'] : '';
14
  $options['adminsort'] = isset($_POST['adminsort']) ? $_POST['adminsort'] : '';
@@ -25,37 +25,37 @@ function cpt_plugin_options()
25
  ?>
26
  <div class="wrap">
27
  <div id="icon-settings" class="icon32"></div>
28
- <h2>General Settings</h2>
29
 
30
  <?php cpt_info_box(); ?>
31
 
32
  <form id="form_data" name="form" method="post">
33
  <br />
34
- <h2 class="subtitle">General</h2>
35
  <table class="form-table">
36
  <tbody>
37
 
38
  <tr valign="top">
39
- <th scope="row" style="text-align: right;"><label>Minimum Level to use this plugin</label></th>
40
  <td>
41
- <select id="role" name="level">
42
- <option value="0" <?php if ($options['level'] == "0") echo 'selected="selected"'?>><?php _e('Subscriber', 'cpt') ?></option>
43
- <option value="1" <?php if ($options['level'] == "1") echo 'selected="selected"'?>><?php _e('Contributor', 'cpt') ?></option>
44
- <option value="2" <?php if ($options['level'] == "2") echo 'selected="selected"'?>><?php _e('Author', 'cpt') ?></option>
45
- <option value="5" <?php if ($options['level'] == "5") echo 'selected="selected"'?>><?php _e('Editor', 'cpt') ?></option>
46
- <option value="8" <?php if ($options['level'] == "8") echo 'selected="selected"'?>><?php _e('Administrator', 'cpt') ?></option>
47
  </select>
48
  </td>
49
  </tr>
50
 
51
  <tr valign="top">
52
- <th scope="row" style="text-align: right;"><label>Auto Sort</label></th>
53
  <td>
54
  <label for="users_can_register">
55
  <input type="checkbox" <?php if ($options['autosort'] == "1") {echo ' checked="checked"';} ?> value="1" name="autosort">
56
  <?php _e("If checked, the plug-in will automatically update the wp-queries to use the new order (<b>No code update is necessarily</b>).<br /> If you need more order customizations you will need to uncheck this and include 'menu_order' into your theme queries", 'cpt') ?>.</label>
57
 
58
- <p><a href="javascript:;" onclick="jQuery('#example1').slideToggle();;return false;">Show Examples</a></p>
59
  <div id="example1" style="display: none">
60
 
61
  <p class="example"><br /><?php _e('The following PHP code will still return the post in the set-up Order', 'cpt') ?>:</p>
@@ -95,7 +95,7 @@ $args = array(
95
 
96
 
97
  <tr valign="top">
98
- <th scope="row" style="text-align: right;"><label>Admin Sort</label></th>
99
  <td>
100
  <label for="users_can_register">
101
  <input type="checkbox" <?php if ($options['adminsort'] == "1") {echo ' checked="checked"';} ?> value="1" name="adminsort">
@@ -107,7 +107,8 @@ $args = array(
107
  </table>
108
 
109
  <p class="submit">
110
- <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Settings', 'cpt') ?>">
 
111
  </p>
112
 
113
  <input type="hidden" name="form_submit" value="true" />
8
  if (isset($_POST['form_submit']))
9
  {
10
 
11
+ $options['capability'] = $_POST['capability'];
12
 
13
  $options['autosort'] = isset($_POST['autosort']) ? $_POST['autosort'] : '';
14
  $options['adminsort'] = isset($_POST['adminsort']) ? $_POST['adminsort'] : '';
25
  ?>
26
  <div class="wrap">
27
  <div id="icon-settings" class="icon32"></div>
28
+ <h2><?php _e('General Settings', 'cpt') ?></h2>
29
 
30
  <?php cpt_info_box(); ?>
31
 
32
  <form id="form_data" name="form" method="post">
33
  <br />
34
+ <h2 class="subtitle"><?php _e('General', 'cpt') ?></h2>
35
  <table class="form-table">
36
  <tbody>
37
 
38
  <tr valign="top">
39
+ <th scope="row" style="text-align: right;"><label><?php _e('Minimum Level to use this plugin', 'cpt') ?></label></th>
40
  <td>
41
+ <select id="role" name="capability">
42
+ <option value="read" <?php if (isset($options['capability']) && $options['capability'] == "read") echo 'selected="selected"'?>><?php _e('Subscriber', 'cpt') ?></option>
43
+ <option value="edit_posts" <?php if (isset($options['capability']) && $options['capability'] == "edit_posts") echo 'selected="selected"'?>><?php _e('Contributor', 'cpt') ?></option>
44
+ <option value="publish_posts" <?php if (isset($options['capability']) && $options['capability'] == "publish_posts") echo 'selected="selected"'?>><?php _e('Author', 'cpt') ?></option>
45
+ <option value="publish_pages" <?php if (isset($options['capability']) && $options['capability'] == "publish_pages") echo 'selected="selected"'?>><?php _e('Editor', 'cpt') ?></option>
46
+ <option value="install_plugins" <?php if (!isset($options['capability']) || empty($options['capability']) || (isset($options['capability']) && $options['capability'] == "install_plugins")) echo 'selected="selected"'?>><?php _e('Administrator', 'cpt') ?></option>
47
  </select>
48
  </td>
49
  </tr>
50
 
51
  <tr valign="top">
52
+ <th scope="row" style="text-align: right;"><label><?php _e('Auto Sort', 'cpt') ?></label></th>
53
  <td>
54
  <label for="users_can_register">
55
  <input type="checkbox" <?php if ($options['autosort'] == "1") {echo ' checked="checked"';} ?> value="1" name="autosort">
56
  <?php _e("If checked, the plug-in will automatically update the wp-queries to use the new order (<b>No code update is necessarily</b>).<br /> If you need more order customizations you will need to uncheck this and include 'menu_order' into your theme queries", 'cpt') ?>.</label>
57
 
58
+ <p><a href="javascript:;" onclick="jQuery('#example1').slideToggle();;return false;"><?php _e('Show Examples', 'cpt') ?></a></p>
59
  <div id="example1" style="display: none">
60
 
61
  <p class="example"><br /><?php _e('The following PHP code will still return the post in the set-up Order', 'cpt') ?>:</p>
95
 
96
 
97
  <tr valign="top">
98
+ <th scope="row" style="text-align: right;"><label><?php _e('Admin Sort', 'cpt') ?></label></th>
99
  <td>
100
  <label for="users_can_register">
101
  <input type="checkbox" <?php if ($options['adminsort'] == "1") {echo ' checked="checked"';} ?> value="1" name="adminsort">
107
  </table>
108
 
109
  <p class="submit">
110
+ <input type="submit" name="Submit" class="button-primary" value="<?php
111
+ _e('Save Settings', 'cpt') ?>">
112
  </p>
113
 
114
  <input type="hidden" name="form_submit" value="true" />
lang/cpt-pt_BR.mo ADDED
Binary file
lang/cpt-pt_BR.po CHANGED
@@ -3,7 +3,7 @@ msgstr ""
3
  "Project-Id-Version: Post Types Order\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: 2010-11-29 09:26-0300\n"
6
- "PO-Revision-Date: 2010-11-29 19:14-0300\n"
7
  "Last-Translator: Gabriel Reguly <gabriel@ppgr.com.br>\n"
8
  "Language-Team: http://ppgr.com.br/\n"
9
  "MIME-Version: 1.0\n"
@@ -11,8 +11,8 @@ msgstr ""
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "X-Poedit-KeywordsList: __;_e\n"
13
  "X-Poedit-Basepath: .\n"
14
- "X-Poedit-Language: Portuguese\n"
15
- "X-Poedit-Country: BRAZIL\n"
16
  "X-Poedit-SearchPath-0: post-types-order\n"
17
 
18
  #: post-types-order/post-types-order.php:41
@@ -34,7 +34,9 @@ msgid "%s - Re-order "
34
  msgstr "Reordenar %s"
35
 
36
  #: post-types-order/post-types-order.php:233
37
- msgid "This plugin can't work without javascript, because it use drag and drop and AJAX."
 
 
38
  msgstr "Este plugin precisa de JavaScript para funcionar."
39
 
40
  #: post-types-order/post-types-order.php:242
@@ -46,8 +48,10 @@ msgid "Item order updated"
46
  msgstr "Ordem alterada"
47
 
48
  #: post-types-order/post-types-order.php:263
49
- msgid "Did you found this plug-in useful? Please support our work with a donation."
50
- msgstr "Você considera útil este plugin? Por favor, faça uma doação para o autor."
 
 
51
 
52
  #: post-types-order/post-types-order.php:283
53
  msgid "Pages"
@@ -92,4 +96,3 @@ msgstr "Administrador"
92
  #: post-types-order/include/options.php:36
93
  msgid "Save Settings"
94
  msgstr "Salvar configuração"
95
-
3
  "Project-Id-Version: Post Types Order\n"
4
  "Report-Msgid-Bugs-To: \n"
5
  "POT-Creation-Date: 2010-11-29 09:26-0300\n"
6
+ "PO-Revision-Date: 2012-12-07 14:22+0200\n"
7
  "Last-Translator: Gabriel Reguly <gabriel@ppgr.com.br>\n"
8
  "Language-Team: http://ppgr.com.br/\n"
9
  "MIME-Version: 1.0\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
  "X-Poedit-KeywordsList: __;_e\n"
13
  "X-Poedit-Basepath: .\n"
14
+ "Language: pt_BR\n"
15
+ "X-Generator: Poedit 1.5.3\n"
16
  "X-Poedit-SearchPath-0: post-types-order\n"
17
 
18
  #: post-types-order/post-types-order.php:41
34
  msgstr "Reordenar %s"
35
 
36
  #: post-types-order/post-types-order.php:233
37
+ msgid ""
38
+ "This plugin can't work without javascript, because it use drag and drop and "
39
+ "AJAX."
40
  msgstr "Este plugin precisa de JavaScript para funcionar."
41
 
42
  #: post-types-order/post-types-order.php:242
48
  msgstr "Ordem alterada"
49
 
50
  #: post-types-order/post-types-order.php:263
51
+ msgid ""
52
+ "Did you found this plug-in useful? Please support our work with a donation."
53
+ msgstr ""
54
+ "Você considera útil este plugin? Por favor, faça uma doação para o autor."
55
 
56
  #: post-types-order/post-types-order.php:283
57
  msgid "Pages"
96
  #: post-types-order/include/options.php:36
97
  msgid "Save Settings"
98
  msgstr "Salvar configuração"
 
lang/cpt-ro_RO.mo ADDED
Binary file
lang/cpt-ro_RO.po ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Post Types Order\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-11-29 09:26-0300\n"
6
+ "PO-Revision-Date: 2012-12-07 14:34+0200\n"
7
+ "Last-Translator: Gabriel Reguly <gabriel@ppgr.com.br>\n"
8
+ "Language-Team: http://ppgr.com.br/\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Language: pt_BR\n"
15
+ "X-Generator: Poedit 1.5.3\n"
16
+ "X-Poedit-SearchPath-0: post-types-order\n"
17
+
18
+ #: post-types-order/post-types-order.php:41
19
+ msgid "Post Types Order"
20
+ msgstr "Post Types Order"
21
+
22
+ #: post-types-order/post-types-order.php:176
23
+ msgid "Invalid post type"
24
+ msgstr "Post Type Invalid"
25
+
26
+ #: post-types-order/post-types-order.php:216
27
+ #: post-types-order/post-types-order.php:218
28
+ msgid "Re-Order"
29
+ msgstr "Re-Order"
30
+
31
+ #: post-types-order/post-types-order.php:229
32
+ #, php-format
33
+ msgid "%s - Re-order "
34
+ msgstr "Reordenar %s"
35
+
36
+ #: post-types-order/post-types-order.php:233
37
+ msgid ""
38
+ "This plugin can't work without javascript, because it use drag and drop and "
39
+ "AJAX."
40
+ msgstr ""
41
+ "Acest plugin nu poate functiona fara JavaScript pentru ca foloseste o "
42
+ "capabilitate AJAX"
43
+
44
+ #: post-types-order/post-types-order.php:242
45
+ msgid "Update"
46
+ msgstr "Actualizare"
47
+
48
+ #: post-types-order/post-types-order.php:257
49
+ msgid "Item order updated"
50
+ msgstr "Ordonare salvata"
51
+
52
+ #: post-types-order/post-types-order.php:263
53
+ msgid ""
54
+ "Did you found this plug-in useful? Please support our work with a donation."
55
+ msgstr ""
56
+ "Ai gasit acest plugin folositor? The rog ajuta exhipa sa dezvolte softul in "
57
+ "continuare printr-o donatie"
58
+
59
+ #: post-types-order/post-types-order.php:283
60
+ msgid "Pages"
61
+ msgstr "Pagini"
62
+
63
+ #: post-types-order/include/options.php:6
64
+ msgid "Settings Saved"
65
+ msgstr "Setari Salvate"
66
+
67
+ #: post-types-order/include/options.php:13
68
+ msgid "General Setings"
69
+ msgstr "Setari Generale"
70
+
71
+ #: post-types-order/include/options.php:16
72
+ msgid "General"
73
+ msgstr "Geral"
74
+
75
+ #: post-types-order/include/options.php:21
76
+ msgid "Minimum Level to use this plugin"
77
+ msgstr "Niveulul minim pentru a utiliza Re-order"
78
+
79
+ #: post-types-order/include/options.php:25
80
+ msgid "Subscriber"
81
+ msgstr "Subscriber"
82
+
83
+ #: post-types-order/include/options.php:26
84
+ msgid "Contributor"
85
+ msgstr "Contributor"
86
+
87
+ #: post-types-order/include/options.php:27
88
+ msgid "Author"
89
+ msgstr "Author"
90
+
91
+ #: post-types-order/include/options.php:28
92
+ msgid "Editor"
93
+ msgstr "Editor"
94
+
95
+ #: post-types-order/include/options.php:29
96
+ msgid "Administrator"
97
+ msgstr "Administrator"
98
+
99
+ #: post-types-order/include/options.php:36
100
+ msgid "Save Settings"
101
+ msgstr "Salveaza"
lang/cpt.mo ADDED
Binary file
lang/cpt.po ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Post Types Order\n"
4
+ "POT-Creation-Date: 2012-12-07 16:41+0200\n"
5
+ "PO-Revision-Date: 2012-12-07 16:41+0200\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Generator: Poedit 1.5.3\n"
12
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-SearchPath-0: .\n"
15
+
16
+ #: post-types-order.php:107
17
+ msgid "Post Types Order must be configured. Please go to"
18
+ msgstr ""
19
+
20
+ #: post-types-order.php:107
21
+ msgid "Settings Page"
22
+ msgstr ""
23
+
24
+ #: post-types-order.php:107
25
+ msgid "make the configuration and save"
26
+ msgstr ""
27
+
28
+ #: post-types-order.php:468
29
+ msgid ""
30
+ "This plugin can't work without javascript, because it's use drag and drop "
31
+ "and AJAX."
32
+ msgstr ""
33
+
34
+ #: post-types-order.php:497
35
+ msgid "Items Order Updated"
36
+ msgstr ""
37
+
38
+ #: post-types-order.php:514
39
+ msgid "Pages"
40
+ msgstr ""
41
+
42
+ #: include/functions.php:65
43
+ msgid ""
44
+ "Did you find this plugin useful? Please support our work with a donation or "
45
+ "write an article about this plugin in your blog with a link to our site"
46
+ msgstr ""
47
+
48
+ #: include/functions.php:66
49
+ msgid "Did you know there is available an Advanced version of this plug-in?"
50
+ msgstr ""
51
+
52
+ #: include/functions.php:66
53
+ msgid "Read more"
54
+ msgstr ""
55
+
56
+ #: include/functions.php:67
57
+ msgid "Check our"
58
+ msgstr ""
59
+
60
+ #: include/functions.php:67
61
+ msgid ""
62
+ "plugin which allow to custom sort categories and custom taxonomies terms"
63
+ msgstr ""
64
+
65
+ #: include/options.php:16
66
+ msgid "Settings Saved"
67
+ msgstr ""
68
+
69
+ #: include/options.php:28
70
+ msgid "General Settings"
71
+ msgstr ""
72
+
73
+ #: include/options.php:34
74
+ msgid "General"
75
+ msgstr ""
76
+
77
+ #: include/options.php:39
78
+ msgid "Minimum Level to use this plugin"
79
+ msgstr ""
80
+
81
+ #: include/options.php:42
82
+ msgid "Subscriber"
83
+ msgstr ""
84
+
85
+ #: include/options.php:43
86
+ msgid "Contributor"
87
+ msgstr ""
88
+
89
+ #: include/options.php:44
90
+ msgid "Author"
91
+ msgstr ""
92
+
93
+ #: include/options.php:45
94
+ msgid "Editor"
95
+ msgstr ""
96
+
97
+ #: include/options.php:46
98
+ msgid "Administrator"
99
+ msgstr ""
100
+
101
+ #: include/options.php:52
102
+ msgid "Auto Sort"
103
+ msgstr ""
104
+
105
+ #: include/options.php:56
106
+ msgid ""
107
+ "If checked, the plug-in will automatically update the wp-queries to use the "
108
+ "new order (<b>No code update is necessarily</b>).<br /> If you need more "
109
+ "order customizations you will need to uncheck this and include 'menu_order' "
110
+ "into your theme queries"
111
+ msgstr ""
112
+
113
+ #: include/options.php:58
114
+ msgid "Show Examples"
115
+ msgstr ""
116
+
117
+ #: include/options.php:61
118
+ msgid "The following PHP code will still return the post in the set-up Order"
119
+ msgstr ""
120
+
121
+ #: include/options.php:74
122
+ msgid "Or"
123
+ msgstr ""
124
+
125
+ #: include/options.php:83
126
+ msgid ""
127
+ "If the Auto Sort is uncheck you will need to use the \"orderby\" and \"order"
128
+ "\" parameters"
129
+ msgstr ""
130
+
131
+ #: include/options.php:98
132
+ msgid "Admin Sort"
133
+ msgstr ""
134
+
135
+ #: include/options.php:102
136
+ msgid ""
137
+ "To affect the admin interface, to see the post types per your new sort, this "
138
+ "need to be checked"
139
+ msgstr ""
140
+
141
+ #: include/options.php:111
142
+ msgid "Save Settings"
143
+ msgstr ""
post-types-order.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: Post Types Order
4
  Plugin URI: http://www.nsp-code.com
5
- Description: Order Posts and 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.5.4
9
  */
10
 
11
  define('CPTPATH', plugin_dir_path(__FILE__));
@@ -28,8 +28,8 @@ function CPTO_activated()
28
  if (!isset($options['adminsort']))
29
  $options['adminsort'] = '1';
30
 
31
- if (!isset($options['level']))
32
- $options['level'] = 8;
33
 
34
  update_option('cpto_options', $options);
35
  }
@@ -58,20 +58,28 @@ function CPTO_pre_get_posts($query)
58
  if (isset($query->query['suppress_filters']))
59
  $query->query['suppress_filters'] = FALSE;
60
 
 
61
  if (isset($query->query_vars['suppress_filters']))
62
  $query->query_vars['suppress_filters'] = FALSE;
 
63
  }
64
 
65
  return $query;
66
  }
67
 
68
- add_filter('posts_orderby', 'CPTOrderPosts');
69
- function CPTOrderPosts($orderBy)
70
  {
71
  global $wpdb;
72
 
73
  $options = get_option('cpto_options');
74
 
 
 
 
 
 
 
75
  if (is_admin())
76
  {
77
  if ($options['adminsort'] == "1")
@@ -80,7 +88,7 @@ function CPTOrderPosts($orderBy)
80
  else
81
  {
82
  if ($options['autosort'] == "1")
83
- $orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
84
  }
85
 
86
  return($orderBy);
@@ -96,20 +104,16 @@ function CPTO_admin_notices()
96
  return;
97
  ?>
98
  <div class="error fade">
99
- <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>
100
  </div>
101
  <?php
102
  }
103
 
104
 
105
- add_action( 'plugins_loaded', 'cpto_load_textdomain', 99 );
106
  function cpto_load_textdomain()
107
  {
108
- $locale = get_locale();
109
- $mofile = CPTPATH . '/lang/cpt-' . $locale . '.mo';
110
- if ( file_exists( $mofile ) ) {
111
- load_textdomain( 'cppt', $mofile );
112
- }
113
  }
114
 
115
  add_action('admin_menu', 'cpto_plugin_menu');
@@ -129,7 +133,12 @@ function initCPTO()
129
 
130
  if (is_admin())
131
  {
132
- if (is_numeric($options['level']))
 
 
 
 
 
133
  {
134
  if (userdata_get_user_level(true) >= $options['level'])
135
  $custom_post_type_order = new CPTO();
@@ -188,11 +197,11 @@ function cpto_get_previous_post_where($where)
188
 
189
  if (count($results) > 0)
190
  {
191
- $where = $wpdb->prepare("WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql");
192
  }
193
  else
194
  {
195
- $where = $wpdb->prepare("WHERE p.post_date < '".$current_post_date."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' AND p.ID != '". $post->ID ."' $posts_in_ex_cats_sql");
196
  }
197
 
198
  return $where;
@@ -265,11 +274,11 @@ function cpto_get_next_post_where($where)
265
 
266
  if (count($results) > 0)
267
  {
268
- $where = $wpdb->prepare("WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql");
269
  }
270
  else
271
  {
272
- $where = $wpdb->prepare("WHERE p.post_date > '".$current_post_date."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' AND p.ID != '". $post->ID ."' $posts_in_ex_cats_sql");
273
  }
274
 
275
  return $where;
@@ -406,17 +415,38 @@ class CPTO
406
  global $userdata;
407
  //put a menu for all custom_type
408
  $post_types = get_post_types();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
  foreach( $post_types as $post_type_name )
410
  {
411
  if ($post_type_name == 'page')
412
  continue;
 
 
 
 
413
 
414
  if ($post_type_name == 'post')
415
- add_submenu_page('edit.php', 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
416
  else
417
  {
418
  if (!is_post_type_hierarchical($post_type_name))
419
- 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') );
420
  }
421
  }
422
  }
@@ -435,7 +465,7 @@ class CPTO
435
 
436
  <noscript>
437
  <div class="error message">
438
- <p>This plugin can't work without javascript, because it's use drag and drop and AJAX.</p>
439
  </div>
440
  </noscript>
441
 
@@ -464,7 +494,7 @@ class CPTO
464
  jQuery("#sortable").disableSelection();
465
  jQuery("#save-order").bind( "click", function() {
466
  jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize") }, function() {
467
- jQuery("#ajax-response").html('<div class="message updated fade"><p>Items Order Updates</p></div>');
468
  jQuery("#ajax-response div").delay(3000).hide("slow");
469
  });
470
  });
2
  /*
3
  Plugin Name: Post Types Order
4
  Plugin URI: http://www.nsp-code.com
5
+ Description: Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability
6
+ Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
+ Version: 1.5.7
9
  */
10
 
11
  define('CPTPATH', plugin_dir_path(__FILE__));
28
  if (!isset($options['adminsort']))
29
  $options['adminsort'] = '1';
30
 
31
+ if (!isset($options['capability']))
32
+ $options['capability'] = 'install_plugins';
33
 
34
  update_option('cpto_options', $options);
35
  }
58
  if (isset($query->query['suppress_filters']))
59
  $query->query['suppress_filters'] = FALSE;
60
 
61
+
62
  if (isset($query->query_vars['suppress_filters']))
63
  $query->query_vars['suppress_filters'] = FALSE;
64
+
65
  }
66
 
67
  return $query;
68
  }
69
 
70
+ add_filter('posts_orderby', 'CPTOrderPosts', 99, 2);
71
+ function CPTOrderPosts($orderBy, $query)
72
  {
73
  global $wpdb;
74
 
75
  $options = get_option('cpto_options');
76
 
77
+ //ignore the bbpress
78
+ if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("reply", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "reply")))
79
+ return $orderBy;
80
+ if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("topic", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "topic")))
81
+ return $orderBy;
82
+
83
  if (is_admin())
84
  {
85
  if ($options['adminsort'] == "1")
88
  else
89
  {
90
  if ($options['autosort'] == "1")
91
+ $orderBy = "{$wpdb->posts}.menu_order, " . $orderBy;
92
  }
93
 
94
  return($orderBy);
104
  return;
105
  ?>
106
  <div class="error fade">
107
+ <p><strong><?php _e('Post Types Order must be configured. Please go to', 'cpt') ?> <a href="<?php echo get_admin_url() ?>options-general.php?page=cpto-options"><?php _e('Settings Page', 'cpt') ?></a> <?php _e('make the configuration and save', 'cpt') ?></strong></p>
108
  </div>
109
  <?php
110
  }
111
 
112
 
113
+ add_action( 'plugins_loaded', 'cpto_load_textdomain');
114
  function cpto_load_textdomain()
115
  {
116
+ load_plugin_textdomain('cpt', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang');
 
 
 
 
117
  }
118
 
119
  add_action('admin_menu', 'cpto_plugin_menu');
133
 
134
  if (is_admin())
135
  {
136
+ if(isset($options['capability']) && !empty($options['capability']))
137
+ {
138
+ if(current_user_can($options['capability']))
139
+ $custom_post_type_order = new CPTO();
140
+ }
141
+ else if (is_numeric($options['level']))
142
  {
143
  if (userdata_get_user_level(true) >= $options['level'])
144
  $custom_post_type_order = new CPTO();
197
 
198
  if (count($results) > 0)
199
  {
200
+ $where = "WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
201
  }
202
  else
203
  {
204
+ $where = "WHERE p.post_date < '".$current_post_date."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' AND p.ID != '". $post->ID ."' $posts_in_ex_cats_sql";
205
  }
206
 
207
  return $where;
274
 
275
  if (count($results) > 0)
276
  {
277
+ $where = "WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
278
  }
279
  else
280
  {
281
+ $where = "WHERE p.post_date > '".$current_post_date."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' AND p.ID != '". $post->ID ."' $posts_in_ex_cats_sql";
282
  }
283
 
284
  return $where;
415
  global $userdata;
416
  //put a menu for all custom_type
417
  $post_types = get_post_types();
418
+
419
+ $options = get_option('cpto_options');
420
+ //get the required user capability
421
+ $capability = '';
422
+ if(isset($options['capability']) && !empty($options['capability']))
423
+ {
424
+ $capability = $options['capability'];
425
+ }
426
+ else if (is_numeric($options['level']))
427
+ {
428
+ $capability = userdata_get_user_level();
429
+ }
430
+ else
431
+ {
432
+ $capability = 'install_plugins';
433
+ }
434
+
435
  foreach( $post_types as $post_type_name )
436
  {
437
  if ($post_type_name == 'page')
438
  continue;
439
+
440
+ //ignore bbpress
441
+ if ($post_type_name == 'reply' || $post_type_name == 'topic')
442
+ continue;
443
 
444
  if ($post_type_name == 'post')
445
+ add_submenu_page('edit.php', 'Re-Order', 'Re-Order', $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
446
  else
447
  {
448
  if (!is_post_type_hierarchical($post_type_name))
449
+ add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order', $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
450
  }
451
  }
452
  }
465
 
466
  <noscript>
467
  <div class="error message">
468
+ <p><?php _e('This plugin can\'t work without javascript, because it\'s use drag and drop and AJAX.', 'cpt') ?></p>
469
  </div>
470
  </noscript>
471
 
494
  jQuery("#sortable").disableSelection();
495
  jQuery("#save-order").bind( "click", function() {
496
  jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize") }, function() {
497
+ jQuery("#ajax-response").html('<div class="message updated fade"><p><?php _e('Items Order Updated', 'cpt') ?></p></div>');
498
  jQuery("#ajax-response div").delay(3000).hide("slow");
499
  });
500
  });
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Nsp Code
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post order, post type order, custom order, admin posts order
5
  Requires at least: 2.8
6
- Tested up to: 3.4.2
7
- Stable tag: 1.5.4
8
 
9
  Order Post Types Objects (posts, any custom post types) using a Drag and Drop Sortable JavaScript AJAX interface.
10
 
@@ -66,6 +66,12 @@ All ideas are welcome and i put them on my list to be implemented into the new v
66
 
67
  == Change Log ==
68
 
 
 
 
 
 
 
69
  = 1.5.4 =
70
  - Updates/Fixes
71
 
3
  Donate link: http://www.nsp-code.com/donate.php
4
  Tags: post order, post type order, custom order, admin posts order
5
  Requires at least: 2.8
6
+ Tested up to: 3.5
7
+ Stable tag: 1.5.7
8
 
9
  Order Post Types Objects (posts, any custom post types) using a Drag and Drop Sortable JavaScript AJAX interface.
10
 
66
 
67
  == Change Log ==
68
 
69
+ = 1.5.7 =
70
+ - Updates/Fixes
71
+ - Using Capabilities instead levels
72
+ - Updating certain code for WordPress 3.5 compatibility
73
+ - Set default order as seccondary query order param
74
+
75
  = 1.5.4 =
76
  - Updates/Fixes
77