PluginProbe
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on / 1.6
Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on v1.6
2.0 1.7.1 1.2.9 1.3 1.4 1.4.1 1.4.2 1.4.3 1.5 1.6 1.7 trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8
import-users / importExtensions / BSIImport.php

BSIImport.php in Import Users & Customers with Meta | WP Ultimate CSV Importer Add-on 1.6, at importExtensions/BSIImport.php

58 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Import Users plugin file.
4 *
5 * Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com
6 */
7
8 namespace Smackcoders\SMUSERS;
9
10 if ( ! defined( 'ABSPATH' ) )
11 exit; // Exit if accessed directly
12
13 class BSIImport extends UsersImport {
14 private static $bsi_instance = null;
15
16 public static function getInstance() {
17 if (BSIImport::$bsi_instance == null) {
18 BSIImport::$bsi_instance = new BSIImport;
19 global $bsi_instance;
20 return BSIImport::$bsi_instance;
21 }
22 return BSIImport::$bsi_instance;
23 }
24 public function set_bsi_values($header_array ,$value_array , $map, $post_id , $type){
25 $post_values = [];
26 $helpers_instance = ImportHelpers::getInstance();
27 $post_values = $helpers_instance->get_header_values($map , $header_array , $value_array);
28
29 $this->bsi_import_function($post_values, $post_id);
30 }
31
32 public function bsi_import_function($data_array, $uID){
33 foreach( $data_array as $daKey => $daVal ) {
34 if(strpos($daKey, 'msi_') === 0) {
35 $msi_custom_key = substr($daKey, 4);
36 $msi_shipping_array[$msi_custom_key] = $daVal;
37 } elseif(strpos($daKey, 'mbi_') === 0) {
38 $mbi_custom_key = substr($daKey, 4);
39 $mbi_billing_array[$mbi_custom_key] = $daVal;
40 } else {
41 update_user_meta($uID, $daKey, $daVal);
42 }
43 }
44 //Import MarketPress Shipping Info
45 if (!empty ($msi_shipping_array)) {
46 $custom_key = 'mp_shipping_info';
47 update_user_meta($uID, $custom_key, $msi_shipping_array);
48 }
49 //Import MarketPress Billing Info
50 if (!empty ($mbi_billing_array)) {
51 $custom_key = 'mp_billing_info';
52 update_user_meta($uID, $custom_key, $mbi_billing_array);
53 }
54 }
55 }
56 global $billing_class;
57 $billing_class = new BSIImport();
58