| @@ -8,41 +8,41 @@ | ||
| 8 | 8 | |
| 9 | 9 | namespace Smackcoders\SMUSERS; |
| 10 | 10 | |
| 11 | 11 | if ( ! defined( 'ABSPATH' ) ) |
| 12 | - exit; // Exit if accessed directly | |
| 12 | + exit; // Exit if accessed directly | |
| 13 | 13 | |
| 14 | 14 | class MultiroleImport extends UsersImport { |
| 15 | + | |
| 16 | + private static $multirole_instance = null; | |
| 15 | 17 | |
| 16 | - private static $multirole_instance = null; | |
| 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 | + } | |
| 17 | 35 | |
| 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 | - } | |
| 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 | 46 | } |
| 47 | 47 | global $member_class; |
| 48 | -$member_class = new MultiroleImport(); | |
| 48 | +$member_class = new MultiroleImport(); | |