Import users from CSV with meta - Version 1.14.3

Version Description

  • Filter added to fix CSV files upload problems
Download this release

Release Info

Developer carazo
Plugin Icon 128x128 Import users from CSV with meta
Version 1.14.3
Comparing to
See all releases

Code changes from version 1.14.2.12 to 1.14.3

Files changed (2) hide show
  1. import-users-from-csv-with-meta.php +24 -1
  2. readme.txt +4 -1
import-users-from-csv-with-meta.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Import users from CSV with meta
4
  Plugin URI: https://www.codection.com
5
  Description: This plugins allows to import users using CSV files to WP database automatically
6
- Version: 1.14.2.12
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -51,6 +51,7 @@ function acui_loader(){
51
  add_action( 'wp_ajax_acui_delete_attachment', 'acui_delete_attachment' );
52
  add_action( 'wp_ajax_acui_bulk_delete_attachment', 'acui_bulk_delete_attachment' );
53
  add_action( 'acui_cron_process', 'acui_cron_process', 10 );
 
54
 
55
  if( is_plugin_active( 'buddypress/bp-loader.php' ) && file_exists( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' ) ){
56
  require_once( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' );
@@ -640,6 +641,28 @@ function acui_bulk_delete_attachment(){
640
  wp_die();
641
  }
642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
643
  // wp-access-areas functions
644
  function acui_set_cap_for_user( $capability , &$user , $add ) {
645
  $has_cap = $user->has_cap( $capability );
3
  Plugin Name: Import users from CSV with meta
4
  Plugin URI: https://www.codection.com
5
  Description: This plugins allows to import users using CSV files to WP database automatically
6
+ Version: 1.14.3
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
51
  add_action( 'wp_ajax_acui_delete_attachment', 'acui_delete_attachment' );
52
  add_action( 'wp_ajax_acui_bulk_delete_attachment', 'acui_bulk_delete_attachment' );
53
  add_action( 'acui_cron_process', 'acui_cron_process', 10 );
54
+ add_filter( 'wp_check_filetype_and_ext', 'acui_wp_check_filetype_and_ext', PHP_INT_MAX, 4 );
55
 
56
  if( is_plugin_active( 'buddypress/bp-loader.php' ) && file_exists( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' ) ){
57
  require_once( plugin_dir_path( __DIR__ ) . 'buddypress/bp-xprofile/classes/class-bp-xprofile-group.php' );
641
  wp_die();
642
  }
643
 
644
+ // try to solve the CSV upload problem
645
+ function acui_wp_check_filetype_and_ext( $values, $file, $filename, $mimes ) {
646
+ if ( extension_loaded( 'fileinfo' ) ) {
647
+ // with the php-extension, a CSV file is issues type text/plain so we fix that back to
648
+ // text/csv by trusting the file extension.
649
+ $finfo = finfo_open( FILEINFO_MIME_TYPE );
650
+ $real_mime = finfo_file( $finfo, $file );
651
+ finfo_close( $finfo );
652
+ if ( $real_mime === 'text/plain' && preg_match( '/\.(csv)$/i', $filename ) ) {
653
+ $values['ext'] = 'csv';
654
+ $values['type'] = 'text/csv';
655
+ }
656
+ } else {
657
+ // without the php-extension, we probably don't have the issue at all, but just to be sure...
658
+ if ( preg_match( '/\.(csv)$/i', $filename ) ) {
659
+ $values['ext'] = 'csv';
660
+ $values['type'] = 'text/csv';
661
+ }
662
+ }
663
+ return $values;
664
+ }
665
+
666
  // wp-access-areas functions
667
  function acui_set_cap_for_user( $capability , &$user , $add ) {
668
  $has_cap = $user->has_cap( $capability );
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://codection.com/go/donate-import-users-from-csv-with-meta/
4
  Tags: csv, import, importer, meta data, meta, user, users, user meta, editor, profile, custom, fields, delimiter, update, insert
5
  Requires at least: 3.4
6
  Tested up to: 5.2.1
7
- Stable tag: 1.14.2.12
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -91,6 +91,9 @@ Plugin will automatically detect:
91
 
92
  == Changelog ==
93
 
 
 
 
94
  = 1.14.2.12 =
95
  * Typos fixed thanks to https://wordpress.org/support/topic/typo-in-the-settings-page/
96
 
4
  Tags: csv, import, importer, meta data, meta, user, users, user meta, editor, profile, custom, fields, delimiter, update, insert
5
  Requires at least: 3.4
6
  Tested up to: 5.2.1
7
+ Stable tag: 1.14.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
91
 
92
  == Changelog ==
93
 
94
+ = 1.14.3 =
95
+ * Filter added to fix CSV files upload problems
96
+
97
  = 1.14.2.12 =
98
  * Typos fixed thanks to https://wordpress.org/support/topic/typo-in-the-settings-page/
99