Import users from CSV with meta - Version 1.11.3.8

Version Description

  • Fixed mail sending in frontend import
  • Now you can activate users with WP Members in frontend import
  • Some fixes and warnings added
Download this release

Release Info

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

Code changes from version 1.11.3.7 to 1.11.3.8

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.11.3.7
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -72,7 +72,6 @@ function acui_loader(){
72
 
73
  function acui_init(){
74
  load_plugin_textdomain( 'import-users-from-csv-with-meta', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
75
-
76
  acui_activate();
77
  }
78
 
@@ -384,7 +383,7 @@ function acui_fileupload_process( $form_data, $is_cron = false, $is_frontend =
384
  $attach_data = wp_generate_attachment_metadata( $attach_id, $filedest );
385
  wp_update_attachment_metadata( $attach_id, $attach_data );
386
 
387
- acui_import_users( $filedest, $form_data, $attach_id, $is_cron );
388
  }
389
  }
390
  }
@@ -402,9 +401,9 @@ function acui_manage_frontend_process( $form_data ){
402
  else
403
  update_option( "acui_frontend_send_mail_updated", false );
404
 
405
- update_option( "acui_frontend_role", $form_data["role-frontend"] );
 
406
  ?>
407
-
408
  <div class="updated">
409
  <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
410
  </div>
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.11.3.8
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
72
 
73
  function acui_init(){
74
  load_plugin_textdomain( 'import-users-from-csv-with-meta', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
 
75
  acui_activate();
76
  }
77
 
383
  $attach_data = wp_generate_attachment_metadata( $attach_id, $filedest );
384
  wp_update_attachment_metadata( $attach_id, $attach_data );
385
 
386
+ acui_import_users( $filedest, $form_data, $attach_id, $is_cron, $is_frontend );
387
  }
388
  }
389
  }
401
  else
402
  update_option( "acui_frontend_send_mail_updated", false );
403
 
404
+ update_option( "acui_frontend_activate_users_wp_members", $form_data["activate_users_wp_members"] );
405
+ update_option( "acui_frontend_role", $form_data["acui_frontend_role"] );
406
  ?>
 
407
  <div class="updated">
408
  <p><?php _e( 'Settings updated correctly', 'import-users-from-csv-with-meta' ) ?></p>
409
  </div>
importer.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
4
 
5
  function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){?>
6
  <div class="wrap">
7
- <h2>Importing users</h2>
8
  <?php
9
  set_time_limit(0);
10
 
@@ -38,16 +38,22 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
38
 
39
  $users_registered = array();
40
  $headers = array();
41
- $headers_filtered = array();
42
- $update_existing_users = $form_data["update_existing_users"];
43
- $role_default = $form_data["role"];
44
- $update_roles_existing_users = $form_data["update_roles_existing_users"];
45
- $empty_cell_action = $form_data["empty_cell_action"];
46
-
47
- if( empty( $form_data["activate_users_wp_members"] ) )
48
- $activate_users_wp_members = "no_activate";
49
- else
50
- $activate_users_wp_members = $form_data["activate_users_wp_members"];
 
 
 
 
 
 
51
 
52
  if( $is_cron ){
53
  if( get_option( "acui_cron_allow_multiple_accounts" ) == "allowed" ){
@@ -104,11 +110,11 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
104
  if( count( $data ) == 1 )
105
  $data = $data[0];
106
 
107
- foreach ($data as $key => $value){
108
  $data[ $key ] = trim( $value );
109
  }
110
 
111
- for($i = 0; $i < count($data); $i++){
112
  $data[$i] = acui_string_conversion( $data[$i] );
113
 
114
  if( is_serialized( $data[$i] ) ) // serialized
@@ -117,7 +123,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
117
  $data[$i] = explode( "::", $data[$i] );
118
  }
119
 
120
- if($row == 0):
121
  // check min columns username - email
122
  if(count( $data ) < 2){
123
  echo "<div id='message' class='error'>" . __( 'File must contain at least 2 columns: username and email', 'import-users-from-csv-with-meta' ) . "</div>";
@@ -690,7 +696,7 @@ function acui_options(){
690
  <br>
691
  </div>
692
 
693
- <h3 class="hndle"><span>&nbsp;<?php _e( 'Old CSV files uploaded', 'import-users-from-csv-with-meta' ); ?></span></h3>
694
 
695
  <div class="inside" style="display: block;">
696
  <p><?php _e( 'For security reasons you should delete this files, probably they would be visible in the Internet if a bot or someone discover the URL. You can delete each file or maybe you want delete all CSV files you have uploaded:', 'import-users-from-csv-with-meta' ); ?></p>
@@ -704,7 +710,7 @@ function acui_options(){
704
  else
705
  $date = get_the_date();
706
  ?>
707
- <li><a href="<?php echo wp_get_attachment_url( get_the_ID() ); ?>"><?php the_title(); ?></a> _e( 'uploaded on', 'import-users-from-csv-with-meta' ) . ' ' . <?php echo $date; ?> <input type="button" value="<?php _e( 'Delete', 'import-users-from-csv-with-meta' ); ?>" class="delete_attachment" attach_id="<?php the_ID(); ?>" /></li>
708
  <?php endwhile; ?>
709
  <?php wp_reset_postdata(); ?>
710
  </ul>
@@ -1042,7 +1048,8 @@ function acui_options(){
1042
  $send_mail_frontend = get_option( "acui_frontend_send_mail");
1043
  $send_mail_updated_frontend = get_option( "acui_frontend_send_mail_updated");
1044
  $role = get_option( "acui_frontend_role");
1045
-
 
1046
  if( empty( $send_mail_frontend ) )
1047
  $send_mail_frontend = false;
1048
 
@@ -1095,6 +1102,22 @@ function acui_options(){
1095
  <p class="description"><?php _e( 'Which role would be used to import users?', 'import-users-from-csv-with-meta' ); ?></p>
1096
  </td>
1097
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1098
  </tbody>
1099
  </table>
1100
  <input class="button-primary" type="submit" value="<?php _e( 'Save frontend import options', 'import-users-from-csv-with-meta'); ?>"/>
4
 
5
  function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false, $is_frontend = false ){?>
6
  <div class="wrap">
7
+ <h2><?php _e('Importing users','import-users-from-csv-with-meta'); ?></h2>
8
  <?php
9
  set_time_limit(0);
10
 
38
 
39
  $users_registered = array();
40
  $headers = array();
41
+ $headers_filtered = array();
42
+ $update_existing_users = isset( $form_data["update_existing_users"] ) ? $form_data["update_existing_users"] : '';
43
+ $role_default = isset( $form_data["role"] ) ? $form_data["role"] : '';
44
+ $update_roles_existing_users = isset( $form_data["update_roles_existing_users"] ) ? $form_data["update_roles_existing_users"] : '';
45
+ $empty_cell_action = isset( $form_data["empty_cell_action"] ) ? $form_data["empty_cell_action"] : '';
46
+
47
+ if( $is_frontend ){
48
+ $activate_users_wp_members = get_option( "acui_frontend_activate_users_wp_members" );
49
+ }
50
+ else{
51
+ if( !isset( $form_data["activate_users_wp_members"] ) || empty( $form_data["activate_users_wp_members"] ) )
52
+ $activate_users_wp_members = "no_activate";
53
+ else
54
+ $activate_users_wp_members = $form_data["activate_users_wp_members"];
55
+ }
56
+
57
 
58
  if( $is_cron ){
59
  if( get_option( "acui_cron_allow_multiple_accounts" ) == "allowed" ){
110
  if( count( $data ) == 1 )
111
  $data = $data[0];
112
 
113
+ foreach ( $data as $key => $value ){
114
  $data[ $key ] = trim( $value );
115
  }
116
 
117
+ for( $i = 0; $i < count($data); $i++ ){
118
  $data[$i] = acui_string_conversion( $data[$i] );
119
 
120
  if( is_serialized( $data[$i] ) ) // serialized
123
  $data[$i] = explode( "::", $data[$i] );
124
  }
125
 
126
+ if( $row == 0 ):
127
  // check min columns username - email
128
  if(count( $data ) < 2){
129
  echo "<div id='message' class='error'>" . __( 'File must contain at least 2 columns: username and email', 'import-users-from-csv-with-meta' ) . "</div>";
696
  <br>
697
  </div>
698
 
699
+ <h3 class="hndle"><span>&nbsp;&nbsp;&nbsp;<?php _e( 'Old CSV files uploaded', 'import-users-from-csv-with-meta' ); ?></span></h3>
700
 
701
  <div class="inside" style="display: block;">
702
  <p><?php _e( 'For security reasons you should delete this files, probably they would be visible in the Internet if a bot or someone discover the URL. You can delete each file or maybe you want delete all CSV files you have uploaded:', 'import-users-from-csv-with-meta' ); ?></p>
710
  else
711
  $date = get_the_date();
712
  ?>
713
+ <li><a href="<?php echo wp_get_attachment_url( get_the_ID() ); ?>"><?php the_title(); ?></a> <?php _e( 'uploaded on', 'import-users-from-csv-with-meta' ) . ' ' . $date; ?> <input type="button" value="<?php _e( 'Delete', 'import-users-from-csv-with-meta' ); ?>" class="delete_attachment" attach_id="<?php the_ID(); ?>" /></li>
714
  <?php endwhile; ?>
715
  <?php wp_reset_postdata(); ?>
716
  </ul>
1048
  $send_mail_frontend = get_option( "acui_frontend_send_mail");
1049
  $send_mail_updated_frontend = get_option( "acui_frontend_send_mail_updated");
1050
  $role = get_option( "acui_frontend_role");
1051
+ $activate_users_wp_members = get_option( "acui_frontend_activate_users_wp_members");
1052
+
1053
  if( empty( $send_mail_frontend ) )
1054
  $send_mail_frontend = false;
1055
 
1102
  <p class="description"><?php _e( 'Which role would be used to import users?', 'import-users-from-csv-with-meta' ); ?></p>
1103
  </td>
1104
  </tr>
1105
+
1106
+ <?php if( is_plugin_active( 'wp-members/wp-members.php' ) ): ?>
1107
+
1108
+ <tr class="form-field form-required">
1109
+ <th scope="row"><label>Activate user when they are being imported?</label></th>
1110
+ <td>
1111
+ <select name="activate_users_wp_members">
1112
+ <option value="no_activate" <?php selected( $activate_users_wp_members,'no_activate', true ); ?>><?php _e( 'Do not activate users', 'import-users-from-csv-with-meta' ); ?></option>
1113
+ <option value="activate" <?php selected( $activate_users_wp_members,'activate', true ); ?>><?php _e( 'Activate users when they are being imported', 'import-users-from-csv-with-meta' ); ?></option>
1114
+ </select>
1115
+
1116
+ <p class="description"><strong>(<?php _e( 'Only for', 'import-users-from-csv-with-meta' ); ?> <a href="https://wordpress.org/plugins/wp-members/"><?php _e( 'WP Members', 'import-users-from-csv-with-meta' ); ?></a> <?php _e( 'users', 'import-users-from-csv-with-meta' ); ?>)</strong>.</p>
1117
+ </td>
1118
+ </tr>
1119
+
1120
+ <?php endif; ?>
1121
  </tbody>
1122
  </table>
1123
  <input class="button-primary" type="submit" value="<?php _e( 'Save frontend import options', 'import-users-from-csv-with-meta'); ?>"/>
include/shortcode-frontend.php CHANGED
@@ -2,7 +2,7 @@
2
  add_shortcode( 'import-users-from-csv-with-meta', 'acui_frontend' );
3
  function acui_frontend() {
4
  ob_start();
5
-
6
  if( !current_user_can( 'create_users' ) )
7
  die( __( 'Only users who are able to create users can manage this form.', 'import-users-from-csv-with-meta' ) );
8
 
2
  add_shortcode( 'import-users-from-csv-with-meta', 'acui_frontend' );
3
  function acui_frontend() {
4
  ob_start();
5
+
6
  if( !current_user_can( 'create_users' ) )
7
  die( __( 'Only users who are able to create users can manage this form.', 'import-users-from-csv-with-meta' ) );
8
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://paypal.me/codection
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: 4.9.8
7
- Stable tag: 1.11.3.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -71,6 +71,11 @@ Plugin will automatically detect:
71
 
72
  == Changelog ==
73
 
 
 
 
 
 
74
  = 1.11.3.7 =
75
  * Fixes and improvements thanks to @malcolm-oph
76
 
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: 4.9.8
7
+ Stable tag: 1.11.3.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
71
 
72
  == Changelog ==
73
 
74
+ = 1.11.3.8 =
75
+ * Fixed mail sending in frontend import
76
+ * Now you can activate users with WP Members in frontend import
77
+ * Some fixes and warnings added
78
+
79
  = 1.11.3.7 =
80
  * Fixes and improvements thanks to @malcolm-oph
81