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 / MultiroleImport.php

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

48 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /******************************************************************************************
3 * Copyright (C) Smackcoders. - All Rights Reserved under Smackcoders Proprietary License
4 * Unauthorized copying of this file, via any medium is strictly prohibited
5 * Proprietary and confidential
6 * You can contact Smackcoders at email address info@smackcoders.com.
7 *******************************************************************************************/
8
9 namespace Smackcoders\SMUSERS;
10
11 if ( ! defined( 'ABSPATH' ) )
12 exit; // Exit if accessed directly
13
14 class MultiroleImport extends UsersImport {
15
16 private static $multirole_instance = null;
17
18 public static function getInstance() {
19
20 if (MultiroleImport::$multirole_instance == null) {
21 MultiroleImport::$multirole_instance = new MultiroleImport;
22 return MultiroleImport::$multirole_instance;
23 }
24 return MultiroleImport::$multirole_instance;
25 }
26
27 function set_multirole_values($header_array ,$value_array , $map, $post_id , $type){
28 $post_values = [];
29 $helpers_instance = ImportHelpers::getInstance();
30 $post_values = $helpers_instance->get_header_values($map , $header_array , $value_array);
31
32 $this->multirole_import_function($post_values, $post_id);
33
34 }
35
36 public function multirole_import_function($data_array, $uID){
37 global $wpdb;
38 if(isset($data_array['multi_user_role'])){
39 $roles = explode('|', $data_array['multi_user_role']);
40 foreach ($roles as $key => $value) {
41 $members_role[$value] = 1;
42 }
43 update_user_meta($uID, $wpdb->prefix.'capabilities', $members_role);
44 }
45 }
46 }
47 global $member_class;
48 $member_class = new MultiroleImport();