Admin Columns - Version 2.5.3

Version Description

  • [Fixed] Fixes an issue with some 3rd party column not being visible
Download this release

Release Info

Developer tschutter
Plugin Icon 128x128 Admin Columns
Version 2.5.3
Comparing to
See all releases

Code changes from version 2.5.2 to 2.5.3

classes/storage_model.php CHANGED
@@ -112,12 +112,6 @@ abstract class CPAC_Storage_Model {
112
  */
113
  private $stored_columns = array();
114
 
115
- /**
116
- * @since 2.5
117
- * @var array
118
- */
119
- private $default_stored = false;
120
-
121
  /**
122
  * @since 2.4.4
123
  */
@@ -181,8 +175,17 @@ abstract class CPAC_Storage_Model {
181
  $default_columns = $this->get_default_column_headings();
182
  }
183
 
184
- // Hook for 3rd party columns that have no other way of being initialized
185
- $default_columns = apply_filters( 'cac/column_types/defaults', $default_columns, $this );
 
 
 
 
 
 
 
 
 
186
 
187
  // Default columns
188
  if ( $default_columns ) {
@@ -225,17 +228,6 @@ abstract class CPAC_Storage_Model {
225
  }
226
  }
227
 
228
- // Custom columns
229
- foreach ( $this->columns_filepath as $classname => $path ) {
230
- include_once $path;
231
- if ( class_exists( $classname, false ) ) {
232
- $column = new $classname( $this->key );
233
- if ( $column->is_registered() ) {
234
- $column_types[ $column->get_type() ] = $column;
235
- }
236
- }
237
- }
238
-
239
  $this->column_types = $column_types;
240
 
241
  // @since 2.5
@@ -671,7 +663,7 @@ abstract class CPAC_Storage_Model {
671
  private function get_storage_id() {
672
  $layout = $this->layout ? $this->layout : null;
673
 
674
- return self::OPTIONS_KEY . '_' . $this->key . $layout;
675
  }
676
 
677
  /**
@@ -883,7 +875,7 @@ abstract class CPAC_Storage_Model {
883
  return get_option( $this->get_storage_key() . "__default", array() );
884
  }
885
 
886
- private function delete_default_stored_columns() {
887
  delete_option( $this->get_storage_key() . "__default" );
888
  }
889
 
@@ -966,23 +958,27 @@ abstract class CPAC_Storage_Model {
966
  */
967
  public function add_headings( $columns ) {
968
 
969
- // in case a 3rd party plugin removes all columns we can skip this
970
  if ( empty( $columns ) ) {
971
  return $columns;
972
  }
973
 
 
 
 
 
 
 
 
 
 
974
  // make sure we run this only once
975
  if ( $this->column_headings ) {
976
  return $this->column_headings;
977
  }
978
 
979
- // Stores the default columns on the listings screen
980
- if ( ! $this->default_stored && $this->is_current_screen() ) {
981
- $this->store_default_columns( $columns );
982
- $this->default_stored = true;
983
- }
984
 
985
- if ( ! ( $stored_columns = $this->get_stored_columns() ) ) {
986
  return $columns;
987
  }
988
 
@@ -1026,7 +1022,7 @@ abstract class CPAC_Storage_Model {
1026
  // Add 3rd party columns that have ( or could ) not been stored.
1027
  // For example when a plugin has been activated after storing column settings.
1028
  // When $diff contains items, it means an available column has not been stored.
1029
- if ( ! $this->is_using_php_export() && ( $diff = array_diff( array_keys( $columns ), array_keys( $this->get_default_stored_columns() ) ) ) ) {
1030
  foreach ( $diff as $column_name ) {
1031
  $this->column_headings[ $column_name ] = $columns[ $column_name ];
1032
  }
112
  */
113
  private $stored_columns = array();
114
 
 
 
 
 
 
 
115
  /**
116
  * @since 2.4.4
117
  */
175
  $default_columns = $this->get_default_column_headings();
176
  }
177
 
178
+ // Custom columns
179
+ foreach ( $this->columns_filepath as $classname => $path ) {
180
+ include_once $path;
181
+ if ( class_exists( $classname, false ) ) {
182
+ $column = new $classname( $this->key );
183
+
184
+ if ( $column->is_registered() ) {
185
+ $column_types[ $column->get_type() ] = $column;
186
+ }
187
+ }
188
+ }
189
 
190
  // Default columns
191
  if ( $default_columns ) {
228
  }
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
231
  $this->column_types = $column_types;
232
 
233
  // @since 2.5
663
  private function get_storage_id() {
664
  $layout = $this->layout ? $this->layout : null;
665
 
666
+ return $this->get_storage_key() . $layout;
667
  }
668
 
669
  /**
875
  return get_option( $this->get_storage_key() . "__default", array() );
876
  }
877
 
878
+ public function delete_default_stored_columns() {
879
  delete_option( $this->get_storage_key() . "__default" );
880
  }
881
 
958
  */
959
  public function add_headings( $columns ) {
960
 
 
961
  if ( empty( $columns ) ) {
962
  return $columns;
963
  }
964
 
965
+ // for the rare case where a screen hasn't been set yet and a
966
+ // plugin uses a custom version of apply_filters( "manage_{$screen->id}_columns", array() )
967
+ if ( ! get_current_screen() ) {
968
+ return $columns;
969
+ }
970
+
971
+ // Stores the default columns on the listings screen
972
+ $this->store_default_columns( $columns );
973
+
974
  // make sure we run this only once
975
  if ( $this->column_headings ) {
976
  return $this->column_headings;
977
  }
978
 
979
+ $stored_columns = $this->get_stored_columns();
 
 
 
 
980
 
981
+ if ( ! $stored_columns ) {
982
  return $columns;
983
  }
984
 
1022
  // Add 3rd party columns that have ( or could ) not been stored.
1023
  // For example when a plugin has been activated after storing column settings.
1024
  // When $diff contains items, it means an available column has not been stored.
1025
+ if ( ! $this->is_using_php_export() && ( $diff = array_diff( array_keys( $columns ), array_keys( (array) $this->get_default_stored_columns() ) ) ) ) {
1026
  foreach ( $diff as $column_name ) {
1027
  $this->column_headings[ $column_name ] = $columns[ $column_name ];
1028
  }
classes/storage_model/comment.php CHANGED
@@ -35,7 +35,6 @@ class CPAC_Storage_Model_Comment extends CPAC_Storage_Model {
35
  'author' => array( 'width' => 20 ),
36
  'response' => array( 'width' => 15 ),
37
  'date' => array( 'width' => 14 ),
38
-
39
  );
40
  }
41
 
35
  'author' => array( 'width' => 20 ),
36
  'response' => array( 'width' => 15 ),
37
  'date' => array( 'width' => 14 ),
 
38
  );
39
  }
40
 
classes/storage_model/post.php CHANGED
@@ -28,15 +28,8 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
28
  public function init_manage_columns() {
29
 
30
  // Headings
31
-
32
- // Since 3.1
33
- add_filter( "manage_{$this->post_type}_posts_columns", array( $this, 'add_headings' ), 100 );
34
-
35
- // Deprecated ( as of 3.1 ) Note: This one is still used by woocommerce.
36
- // Priority set to 100 top make sure the WooCommerce headings are overwritten by CAC
37
- // Filter is located in get_column_headers().
38
- // @todo_minor check compatibility issues for this deprecated filter
39
- add_filter( "manage_{$this->page}-{$this->post_type}_columns", array( $this, 'add_headings' ), 100 );
40
 
41
  // values
42
  add_action( "manage_{$this->post_type}_posts_custom_column", array( $this, 'manage_value_callback' ), 100, 2 );
@@ -86,7 +79,7 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
86
  setup_postdata( $post );
87
 
88
  // Remove Admin Columns action for this column's value
89
- remove_action( "manage_{$this->post_type}_posts_custom_column", array( $this, 'manage_value_callback' ), 100, 2 );
90
 
91
  ob_start();
92
  // Run WordPress native actions to display column content
28
  public function init_manage_columns() {
29
 
30
  // Headings
31
+ // Filter is located in get_column_headers()
32
+ add_filter( "manage_{$this->page}-{$this->post_type}_columns", array( $this, 'add_headings' ), 200 );
 
 
 
 
 
 
 
33
 
34
  // values
35
  add_action( "manage_{$this->post_type}_posts_custom_column", array( $this, 'manage_value_callback' ), 100, 2 );
79
  setup_postdata( $post );
80
 
81
  // Remove Admin Columns action for this column's value
82
+ remove_action( "manage_{$this->post_type}_posts_custom_column", array( $this, 'manage_value_callback' ), 100 );
83
 
84
  ob_start();
85
  // Run WordPress native actions to display column content
classes/storage_model/user.php CHANGED
@@ -21,7 +21,6 @@ class CPAC_Storage_Model_User extends CPAC_Storage_Model {
21
  * @since 2.4.9
22
  */
23
  public function init_manage_columns() {
24
-
25
  add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ), 100 );
26
  add_filter( 'manage_users_custom_column', array( $this, 'manage_value_callback' ), 100, 3 );
27
  }
21
  * @since 2.4.9
22
  */
23
  public function init_manage_columns() {
 
24
  add_filter( "manage_{$this->page}_columns", array( $this, 'add_headings' ), 100 );
25
  add_filter( 'manage_users_custom_column', array( $this, 'manage_value_callback' ), 100, 3 );
26
  }
codepress-admin-columns.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Admin Columns
4
- Version: 2.5.2
5
  Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
6
  Author: AdminColumns.com
7
  Author URI: https://www.admincolumns.com
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
  }
33
 
34
  // Plugin information
35
- define( 'CPAC_VERSION', '2.5.2' ); // Current plugin version
36
  define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // Latest version which requires an upgrade
37
  define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
38
  define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
@@ -171,7 +171,6 @@ class CPAC {
171
  * @uses load_plugin_textdomain()
172
  */
173
  public function localize() {
174
-
175
  load_plugin_textdomain( 'codepress-admin-columns', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
176
  }
177
 
@@ -286,15 +285,11 @@ class CPAC {
286
  */
287
  public function set_columns() {
288
 
289
- $storage_model = false;
290
-
291
  // Listings screen
292
- if ( $this->is_columns_screen() ) {
293
- $storage_model = $this->get_current_storage_model();
294
- }
295
 
296
  // WP Ajax calls (not AC)
297
- else if ( $model = cac_wp_is_doing_ajax() ) {
298
  $storage_model = $this->get_storage_model( $model );
299
  }
300
 
@@ -313,7 +308,7 @@ class CPAC {
313
  * @return CPAC_Storage_Model
314
  */
315
  public function get_current_storage_model() {
316
- if ( ! $this->current_storage_model && $this->get_storage_models() ) {
317
  foreach ( $this->get_storage_models() as $storage_model ) {
318
  if ( $storage_model->is_current_screen() ) {
319
  $this->current_storage_model = $storage_model;
1
  <?php
2
  /*
3
  Plugin Name: Admin Columns
4
+ Version: 2.5.3
5
  Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
6
  Author: AdminColumns.com
7
  Author URI: https://www.admincolumns.com
32
  }
33
 
34
  // Plugin information
35
+ define( 'CPAC_VERSION', '2.5.3' ); // Current plugin version
36
  define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // Latest version which requires an upgrade
37
  define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
38
  define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
171
  * @uses load_plugin_textdomain()
172
  */
173
  public function localize() {
 
174
  load_plugin_textdomain( 'codepress-admin-columns', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
175
  }
176
 
285
  */
286
  public function set_columns() {
287
 
 
 
288
  // Listings screen
289
+ $storage_model = $this->get_current_storage_model();
 
 
290
 
291
  // WP Ajax calls (not AC)
292
+ if ( $model = cac_wp_is_doing_ajax() ) {
293
  $storage_model = $this->get_storage_model( $model );
294
  }
295
 
308
  * @return CPAC_Storage_Model
309
  */
310
  public function get_current_storage_model() {
311
+ if ( ! $this->current_storage_model && $this->is_columns_screen() && $this->get_storage_models() ) {
312
  foreach ( $this->get_storage_models() as $storage_model ) {
313
  if ( $storage_model->is_current_screen() ) {
314
  $this->current_storage_model = $storage_model;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
5
  Requires at least: 3.5
6
  Tested up to: 4.4.2
7
- Stable tag: 2.5.2
8
 
9
  Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
10
 
@@ -210,6 +210,9 @@ You can find a list of the available actions and filters (and examples on how to
210
 
211
  == Changelog ==
212
 
 
 
 
213
  = 2.5.2 =
214
  * [Fixed] Fixes an issue where some of the WordPress default columns did not display correctly
215
 
4
  Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
5
  Requires at least: 3.5
6
  Tested up to: 4.4.2
7
+ Stable tag: 2.5.3
8
 
9
  Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
10
 
210
 
211
  == Changelog ==
212
 
213
+ = 2.5.3 =
214
+ * [Fixed] Fixes an issue with some 3rd party column not being visible
215
+
216
  = 2.5.2 =
217
  * [Fixed] Fixes an issue where some of the WordPress default columns did not display correctly
218