Updating the member csv import for categories.
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 26 Jul 2017 13:39:25 +0000 (09:39 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 26 Jul 2017 13:39:25 +0000 (09:39 -0400)
Fix where it wasn't assigning to correct parent category when importing
the member categories.

index.php
models/admin/import/index.php
readme.txt

index 658c6e2..1a30460 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
  * Plugin Name: GLM Members Database
  * Plugin URI: http://www.gaslightmedia.com/
  * Description: Gaslight Media Members Database.
- * Version: 2.10.0
+ * Version: 2.10.1
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
  * License: GPL2
@@ -19,7 +19,7 @@
  * @package glmMembersDatabase
  * @author Chuck Scott <cscott@gaslightmedia.com>
  * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 2.10.0
+ * @version 2.10.1
  */
 
 /*
@@ -38,7 +38,7 @@
  *
  */
 
-define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.0');
+define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.1');
 define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.32');
 
 // Check if plugin version is not current in WordPress option and if needed updated it
index 1e3f10b..6122e5e 100644 (file)
@@ -892,12 +892,14 @@ class GlmMembersAdmin_import_index
                 if ( $categoryId ) {
                     $this->categories[$data['id']]['new_id'] = $categoryId;
                 } else {
+                    $parentId = isset( $this->categories[$data['parent']]['new_id'] ) ? $this->categories[$data['parent']]['new_id']: 0;
                     $success = $this->wpdb->insert(
                         GLM_MEMBERS_PLUGIN_DB_PREFIX . 'categories',
                         array(
-                            'name' => $data['name']
+                            'name'   => $data['name'],
+                            'parent' => $parentId
                         ),
-                        '%s'
+                        array( '%s', '%d' )
                     );
                     if ( $success ) {
                         $this->categories[$data['id']]['new_id'] = $this->wpdb->insert_id;
index d87a6b0..a5027be 100644 (file)
@@ -66,6 +66,9 @@ There is of course much more to this.
 (none)
 
 == Changelog ==
+= 2.10.1 =
+* Fix the member CSV import for categories. Now assigns them correctly to
+  their parent category.
 
 = 2.10.0 =
 * Adding Member CSV Import feature.