From f60e6fc75c9c6506729dc24e8b18ba99ad59bd81 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 26 Jul 2017 09:39:25 -0400 Subject: [PATCH] Updating the member csv import for categories. Fix where it wasn't assigning to correct parent category when importing the member categories. --- index.php | 6 +++--- models/admin/import/index.php | 6 ++++-- readme.txt | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 658c6e24..1a304605 100644 --- 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 * @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 diff --git a/models/admin/import/index.php b/models/admin/import/index.php index 1e3f10bb..6122e5e2 100644 --- a/models/admin/import/index.php +++ b/models/admin/import/index.php @@ -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; diff --git a/readme.txt b/readme.txt index d87a6b07..a5027be9 100644 --- a/readme.txt +++ b/readme.txt @@ -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. -- 2.17.1