Import users from CSV with meta - Version 1.10.12

Version Description

  • You can now import WP User Groups and assign them to the users thanks to the support of Arturas & Luis, Lda.
Download this release

Release Info

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

Code changes from version 1.10.11.1 to 1.10.12

addons/acui-wp-users-group.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) exit;
4
+
5
+ if( is_plugin_active( 'wp-user-groups/wp-user-groups.php' ) ){
6
+ add_filter( 'acui_restricted_fields', 'acui_wpug_restricted_fields', 10, 1 );
7
+ add_action( 'acui_documentation_after_plugins_activated', 'acui_wpug_documentation_after_plugins_activated' );
8
+ add_action( 'post_acui_import_single_user', 'acui_wpug_post_import_single_user', 10, 3 );
9
+ }
10
+
11
+ function acui_wpug_restricted_fields( $acui_restricted_fields ){
12
+ return array_merge( $acui_restricted_fields, array( 'user_group' ) );
13
+ }
14
+
15
+ function acui_wpug_documentation_after_plugins_activated(){
16
+ ?>
17
+ <tr valign="top">
18
+ <th scope="row"><?php _e( "WP Users Group is activated", 'import-users-from-csv-with-meta' ); ?></th>
19
+ <td>
20
+ <?php _e( "You can import user groups and assign them to the users using the next format", 'import-users-from-csv-with-meta' ); ?>.
21
+ <ul style="list-style:disc outside none; margin-left:2em;">
22
+ <li><?php _e( "user_group as the column title", 'import-users-from-csv-with-meta' ); ?></li>
23
+ <li><?php _e( "The value of each cell will be the name of the user group (do not use slugs)", 'import-users-from-csv-with-meta' ); ?></li>
24
+ <li><?php _e( "If you want to import multiple values, you can use a list using commas to separate items", 'import-users-from-csv-with-meta' ); ?></li>
25
+ </ul>
26
+ </td>
27
+ </tr>
28
+ <?php
29
+ }
30
+
31
+ function acui_wpug_post_import_single_user( $headers, $row, $user_id ){
32
+ $pos = array_search( 'user_group', $headers );
33
+
34
+ if( $pos === FALSE )
35
+ return;
36
+
37
+ $user_groups = explode( ',', $row[ $pos ] );
38
+ $user_groups = array_filter( $user_groups, function( $value ){ return $value !== ''; } );
39
+
40
+ $taxonomy = 'user-group';
41
+ $terms = array();
42
+
43
+ foreach ( $user_groups as $user_group ) {
44
+ $term = get_term_by( 'name', $user_group , $taxonomy );
45
+
46
+ if( $term == false ){
47
+ $term = wp_insert_term( $user_group, $taxonomy);
48
+ $terms[] = $term['term_id'];
49
+ }else{
50
+ $terms[] = $term->term_id;
51
+ }
52
+ }
53
+
54
+ wp_set_object_terms( $user_id, $terms, $taxonomy, false );
55
+ clean_object_term_cache( $user_id, $taxonomy );
56
+ }
assets/style.css ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .acui .main_bar{
2
+ float: left;
3
+ width: 80%;
4
+ }
5
+
6
+ .acui .sidebar {
7
+ float: right;
8
+ font-size: 12px;
9
+ margin: 0 1%;
10
+ width: 18%;
11
+ }
12
+
13
+ .acui .sidebar_section{
14
+ background-color: #F6F6F6;
15
+ border: 1px solid #8A2BE2;
16
+ float: left;
17
+ margin: 0 0 10px;
18
+ padding: 10px;
19
+ width: 100%;
20
+ }
21
+
22
+ .acui .sidebar ul {
23
+ margin: 0;
24
+ padding: 0;
25
+ }
26
+
27
+ .acui .sidebar li {
28
+ font-size: 11px;
29
+ line-height: 16px;
30
+ list-style: disc outside none;
31
+ margin: 5px 0 5px 20px;
32
+ }
33
+
34
+ .acui .sidebar h3 {
35
+ margin: 0 0 10px;
36
+ }
37
+
38
+ .acui .sidebar_section label {
39
+ font-size: 11px;
40
+ }
41
+
42
+ .acui #vote_us{
43
+ cursor: pointer;
44
+ }
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.10.11.1
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
@@ -39,6 +39,7 @@ function acui_loader(){
39
  register_deactivation_hook( __FILE__, 'acui_deactivate' );
40
  add_action( "plugins_loaded", "acui_init" );
41
  add_action( "admin_menu", "acui_menu" );
 
42
  add_filter( 'plugin_row_meta', 'acui_plugin_row_meta', 10, 2 );
43
  add_action( 'admin_init', 'acui_modify_user_edit_admin' );
44
  add_action( 'wp_ajax_acui_delete_attachment', 'acui_delete_attachment' );
@@ -101,6 +102,10 @@ function acui_deactivate(){
101
  wp_clear_scheduled_hook( 'acui_cron' );
102
  }
103
 
 
 
 
 
104
  function acui_delete_options(){
105
  global $acui_smtp_options;
106
 
@@ -143,7 +148,7 @@ function acui_menu() {
143
  function acui_plugin_row_meta( $links, $file ){
144
  if ( strpos( $file, basename( __FILE__ ) ) !== false ) {
145
  $new_links = array(
146
- '<a href="https://www.paypal.me/codection" target="_blank">' . __( 'Donate', 'import-users-from-csv-with-meta' ) . '</a>',
147
  '<a href="mailto:contacto@codection.com" target="_blank">' . __( 'Premium support', 'import-users-from-csv-with-meta' ) . '</a>',
148
  '<a href="http://codection.com/tienda" target="_blank">' . __( 'Premium plugins', 'import-users-from-csv-with-meta' ) . '</a>',
149
  );
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.10.12
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
39
  register_deactivation_hook( __FILE__, 'acui_deactivate' );
40
  add_action( "plugins_loaded", "acui_init" );
41
  add_action( "admin_menu", "acui_menu" );
42
+ add_action( 'admin_enqueue_scripts', 'acui_admin_enqueue_scripts' );
43
  add_filter( 'plugin_row_meta', 'acui_plugin_row_meta', 10, 2 );
44
  add_action( 'admin_init', 'acui_modify_user_edit_admin' );
45
  add_action( 'wp_ajax_acui_delete_attachment', 'acui_delete_attachment' );
102
  wp_clear_scheduled_hook( 'acui_cron' );
103
  }
104
 
105
+ function acui_admin_enqueue_scripts() {
106
+ wp_enqueue_style( 'acui_css', plugin_dir_url( __FILE__ ) . '/assets/style.css', false, '1.0.0' );
107
+ }
108
+
109
  function acui_delete_options(){
110
  global $acui_smtp_options;
111
 
148
  function acui_plugin_row_meta( $links, $file ){
149
  if ( strpos( $file, basename( __FILE__ ) ) !== false ) {
150
  $new_links = array(
151
+ '<a href="https://www.paypal.me/imalrod" target="_blank">' . __( 'Donate', 'import-users-from-csv-with-meta' ) . '</a>',
152
  '<a href="mailto:contacto@codection.com" target="_blank">' . __( 'Premium support', 'import-users-from-csv-with-meta' ) . '</a>',
153
  '<a href="http://codection.com/tienda" target="_blank">' . __( 'Premium plugins', 'import-users-from-csv-with-meta' ) . '</a>',
154
  );
importer.php CHANGED
@@ -617,7 +617,7 @@ function acui_options(){
617
 
618
  acui_check_options();
619
  ?>
620
- <div class="wrap">
621
 
622
  <?php if( $old_csv_files->found_posts > 0 ): ?>
623
  <div class="postbox">
@@ -651,13 +651,13 @@ function acui_options(){
651
  <div id='message' class='updated'><?php _e( 'File must contain at least <strong>2 columns: username and email</strong>. These should be the first two columns and it should be placed <strong>in this order: username and email</strong>. If there are more columns, this plugin will manage it automatically.', 'import-users-from-csv-with-meta' ); ?></div>
652
  <div id='message-password' class='error'><?php _e( 'Please, read carefully how <strong>passwords are managed</strong> and also take note about capitalization, this plugin is <strong>case sensitive</strong>.', 'import-users-from-csv-with-meta' ); ?></div>
653
 
654
- <div style="float:left; width:80%;">
655
  <h2><?php _e( 'Import users from CSV','import-users-from-csv-with-meta' ); ?></h2>
656
  </div>
657
 
658
  <div style="clear:both;"></div>
659
 
660
- <div style="width:100%;">
661
  <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" onsubmit="return check();">
662
  <table class="form-table">
663
  <tbody>
@@ -851,6 +851,28 @@ function acui_options(){
851
  </form>
852
  </div>
853
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
854
  </div>
855
  <script type="text/javascript">
856
  function check(){
@@ -914,6 +936,11 @@ function acui_options(){
914
  $("#upload_file,#introduce_path").toggle();
915
  } );
916
 
 
 
 
 
 
917
  } );
918
  </script>
919
 
@@ -1393,7 +1420,7 @@ function acui_options(){
1393
  <div class="inside" style="display: block;">
1394
  <img src="<?php echo $url_plugin; ?>icon_coffee.png" alt="<?php _e( 'buy me a coffee', 'import-users-from-csv-with-meta' ); ?>" style=" margin: 5px; float:left;">
1395
  <p><?php _e( 'Hi! we are', 'import-users-from-csv-with-meta'); ?> <a href="https://twitter.com/fjcarazo" target="_blank" title="Javier Carazo">Javier Carazo</a> <?php _e( 'and', 'import-users-from-csv-with-meta' ); ?> <a href="https://twitter.com/ahornero" target="_blank" title="Alberto Hornero">Alberto Hornero</a> <?php _e( 'from', 'import-users-from-csv-with-meta' ); ?> <a href="http://codection.com">Codection</a>, <?php _e("developers of this plugin.", 'import-users-from-csv-with-meta' ); ?></p>
1396
- <p><?php _e( 'We have been spending many hours to develop this plugin. <br>If you like and use this plugin, you can <strong>buy us a cup of coffee</strong>.', 'import-users-from-csv-with-meta' ); ?></p>
1397
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
1398
  <input type="hidden" name="cmd" value="_s-xclick">
1399
  <input type="hidden" name="hosted_button_id" value="QPYVWKJG4HDGG">
617
 
618
  acui_check_options();
619
  ?>
620
+ <div class="wrap acui">
621
 
622
  <?php if( $old_csv_files->found_posts > 0 ): ?>
623
  <div class="postbox">
651
  <div id='message' class='updated'><?php _e( 'File must contain at least <strong>2 columns: username and email</strong>. These should be the first two columns and it should be placed <strong>in this order: username and email</strong>. If there are more columns, this plugin will manage it automatically.', 'import-users-from-csv-with-meta' ); ?></div>
652
  <div id='message-password' class='error'><?php _e( 'Please, read carefully how <strong>passwords are managed</strong> and also take note about capitalization, this plugin is <strong>case sensitive</strong>.', 'import-users-from-csv-with-meta' ); ?></div>
653
 
654
+ <div>
655
  <h2><?php _e( 'Import users from CSV','import-users-from-csv-with-meta' ); ?></h2>
656
  </div>
657
 
658
  <div style="clear:both;"></div>
659
 
660
+ <div class="main_bar">
661
  <form method="POST" enctype="multipart/form-data" action="" accept-charset="utf-8" onsubmit="return check();">
662
  <table class="form-table">
663
  <tbody>
851
  </form>
852
  </div>
853
 
854
+ <div class="sidebar">
855
+ <div class="sidebar_section" id="vote_us">
856
+ <h3>Rate Us</h3>
857
+ <ul>
858
+ <li><label>If you like it, Please vote and support us.</label></li>
859
+ </ul>
860
+ </div>
861
+ <div class="sidebar_section">
862
+ <h3>Having Issues?</h3>
863
+ <ul>
864
+ <li><label>You can create a ticket</label> <a target="_blank" href="http://wordpress.org/support/plugin/import-users-from-csv-with-meta"><label>WordPress support forum</label></a></li>
865
+ <li><label>You can ask for premium support</label> <a target="_blank" href="mailto:contacto@codection.com"><label>contacto@codection.com</label></a></li>
866
+ </ul>
867
+ </div>
868
+ <div class="sidebar_section">
869
+ <h3>Donate</h3>
870
+ <ul>
871
+ <li><label>If you appreciate our work and you want to help us to continue developing it and giving the best support</label> <a target="_blank" href="https://paypal.me/imalrod"><label>donate</label></a></li>
872
+ </ul>
873
+ </div>
874
+ </div>
875
+
876
  </div>
877
  <script type="text/javascript">
878
  function check(){
936
  $("#upload_file,#introduce_path").toggle();
937
  } );
938
 
939
+ $("#vote_us").click(function(){
940
+ var win=window.open("http://wordpress.org/support/view/plugin-reviews/import-users-from-csv-with-meta?free-counter?rate=5#postform", '_blank');
941
+ win.focus();
942
+ });
943
+
944
  } );
945
  </script>
946
 
1420
  <div class="inside" style="display: block;">
1421
  <img src="<?php echo $url_plugin; ?>icon_coffee.png" alt="<?php _e( 'buy me a coffee', 'import-users-from-csv-with-meta' ); ?>" style=" margin: 5px; float:left;">
1422
  <p><?php _e( 'Hi! we are', 'import-users-from-csv-with-meta'); ?> <a href="https://twitter.com/fjcarazo" target="_blank" title="Javier Carazo">Javier Carazo</a> <?php _e( 'and', 'import-users-from-csv-with-meta' ); ?> <a href="https://twitter.com/ahornero" target="_blank" title="Alberto Hornero">Alberto Hornero</a> <?php _e( 'from', 'import-users-from-csv-with-meta' ); ?> <a href="http://codection.com">Codection</a>, <?php _e("developers of this plugin.", 'import-users-from-csv-with-meta' ); ?></p>
1423
+ <p><?php _e( 'We have been spending many hours to develop this plugin and answering questions in the forum to give you the best support. <br>If you like and use this plugin, you can <strong>buy us a cup of coffee</strong>.', 'import-users-from-csv-with-meta' ); ?></p>
1424
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
1425
  <input type="hidden" name="cmd" value="_s-xclick">
1426
  <input type="hidden" name="hosted_button_id" value="QPYVWKJG4HDGG">
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.4
7
- Stable tag: 1.10.11.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -70,6 +70,9 @@ Plugin will automatically detect:
70
 
71
  == Changelog ==
72
 
 
 
 
73
  = 1.10.11.1 =
74
  * Debug notice shown fixed (thanks for submiting the bug @anieves (https://wordpress.org/support/topic/problem-using-wp-members-with-import-users-from-csv-2/#post-10035037)
75
 
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.4
7
+ Stable tag: 1.10.12
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.10.12 =
74
+ * You can now import WP User Groups and assign them to the users thanks to the support of Arturas & Luis, Lda.
75
+
76
  = 1.10.11.1 =
77
  * Debug notice shown fixed (thanks for submiting the bug @anieves (https://wordpress.org/support/topic/problem-using-wp-members-with-import-users-from-csv-2/#post-10035037)
78