Import users from CSV with meta - Version 1.15.6.6

Version Description

  • Added multiple hooks to filter all about emails being sent when importing
  • Included new variables in hooks that already exists in emails being sent when importing
Download this release

Release Info

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

Code changes from version 1.15.6.5 to 1.15.6.6

Files changed (3) hide show
  1. import-users-from-csv-with-meta.php +1 -1
  2. importer.php +19 -14
  3. readme.txt +5 -1
import-users-from-csv-with-meta.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Import and export users and customers
4
  Plugin URI: https://www.codection.com
5
  Description: Using this plugin you will be able to import and export users or customers choosing many options and interacting with lots of other plugins
6
- Version: 1.15.6.5
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
3
  Plugin Name: Import and export users and customers
4
  Plugin URI: https://www.codection.com
5
  Description: Using this plugin you will be able to import and export users or customers choosing many options and interacting with lots of other plugins
6
+ Version: 1.15.6.6
7
  Author: codection
8
  Author URI: https://codection.com
9
  License: GPL2
importer.php CHANGED
@@ -597,51 +597,56 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
597
  $key = get_password_reset_key( $user_object );
598
  $user_login= $user_object->user_login;
599
 
600
- $body_mail = get_option( "acui_mail_body" );
601
  $subject = get_option( "acui_mail_subject" );
602
 
603
- $body_mail = str_replace( "**loginurl**", wp_login_url(), $body_mail );
604
- $body_mail = str_replace( "**username**", $user_login, $body_mail );
605
- $body_mail = str_replace( "**lostpasswordurl**", wp_lostpassword_url(), $body_mail );
606
  $subject = str_replace( "**username**", $user_login, $subject );
607
 
608
  if( !is_wp_error( $key ) ){
609
  $passwordreseturl = apply_filters( 'acui_email_passwordreseturl', network_site_url( 'wp-login.php?action=rp&key=' . $key . '&login=' . rawurlencode( $user_login ), 'login' ) );
610
- $body_mail = str_replace( "**passwordreseturl**", $passwordreseturl, $body_mail );
611
 
612
  $passwordreseturllink = wp_sprintf( '<a href="%s">%s</a>', $passwordreseturl, __( 'Password reset link', 'import-users-from-csv-with-meta' ) );
613
- $body_mail = str_replace( "**passwordreseturllink**", $passwordreseturllink, $body_mail );
614
  }
615
 
616
  if( empty( $password ) && !$created ){
617
  $password = __( 'Password has not been changed', 'import-users-from-csv-with-meta' );
618
  }
619
 
620
- $body_mail = str_replace( "**password**", $password, $body_mail );
621
- $body_mail = str_replace( "**email**", $email, $body_mail );
622
 
623
  foreach ( $wp_users_fields as $wp_users_field ) {
624
  if( $positions[ $wp_users_field ] != false && $wp_users_field != "password" ){
625
- $body_mail = str_replace( "**" . $wp_users_field . "**", $data[ $positions[ $wp_users_field ] ] , $body_mail );
626
  $subject = str_replace( "**" . $wp_users_field . "**", $data[ $positions[ $wp_users_field ] ] , $subject );
627
  }
628
  }
629
 
630
  for( $i = 0 ; $i < count( $headers ); $i++ ) {
631
  $data[ $i ] = ( is_array( $data[ $i ] ) ) ? implode( "-", $data[ $i ] ) : $data[ $i ];
632
- $body_mail = str_replace( "**" . $headers[ $i ] . "**", $data[ $i ] , $body_mail );
633
  $subject = str_replace( "**" . $headers[ $i ] . "**", $data[ $i ] , $subject );
634
  }
635
 
636
- $body_mail = wpautop( $body_mail );
637
- $headers_mail = apply_filters( 'acui_import_email_headers', array( 'Content-Type: text/html; charset=UTF-8' ), $headers, $data );
638
-
639
  $attachments = array();
640
  $attachment_id = get_option( 'acui_mail_attachment_id' );
641
  if( !empty( $attachment_id ) )
642
  $attachments[] = get_attached_file( $attachment_id );
643
 
644
- wp_mail( apply_filters( 'acui_import_email_to', $email, $headers, $data ), $subject, $body_mail, $headers_mail );
 
 
 
 
 
 
645
  endif;
646
 
647
  endif;
597
  $key = get_password_reset_key( $user_object );
598
  $user_login= $user_object->user_login;
599
 
600
+ $body = get_option( "acui_mail_body" );
601
  $subject = get_option( "acui_mail_subject" );
602
 
603
+ $body = str_replace( "**loginurl**", wp_login_url(), $body );
604
+ $body = str_replace( "**username**", $user_login, $body );
605
+ $body = str_replace( "**lostpasswordurl**", wp_lostpassword_url(), $body );
606
  $subject = str_replace( "**username**", $user_login, $subject );
607
 
608
  if( !is_wp_error( $key ) ){
609
  $passwordreseturl = apply_filters( 'acui_email_passwordreseturl', network_site_url( 'wp-login.php?action=rp&key=' . $key . '&login=' . rawurlencode( $user_login ), 'login' ) );
610
+ $body = str_replace( "**passwordreseturl**", $passwordreseturl, $body );
611
 
612
  $passwordreseturllink = wp_sprintf( '<a href="%s">%s</a>', $passwordreseturl, __( 'Password reset link', 'import-users-from-csv-with-meta' ) );
613
+ $body = str_replace( "**passwordreseturllink**", $passwordreseturllink, $body );
614
  }
615
 
616
  if( empty( $password ) && !$created ){
617
  $password = __( 'Password has not been changed', 'import-users-from-csv-with-meta' );
618
  }
619
 
620
+ $body = str_replace( "**password**", $password, $body );
621
+ $body = str_replace( "**email**", $email, $body );
622
 
623
  foreach ( $wp_users_fields as $wp_users_field ) {
624
  if( $positions[ $wp_users_field ] != false && $wp_users_field != "password" ){
625
+ $body = str_replace( "**" . $wp_users_field . "**", $data[ $positions[ $wp_users_field ] ] , $body );
626
  $subject = str_replace( "**" . $wp_users_field . "**", $data[ $positions[ $wp_users_field ] ] , $subject );
627
  }
628
  }
629
 
630
  for( $i = 0 ; $i < count( $headers ); $i++ ) {
631
  $data[ $i ] = ( is_array( $data[ $i ] ) ) ? implode( "-", $data[ $i ] ) : $data[ $i ];
632
+ $body = str_replace( "**" . $headers[ $i ] . "**", $data[ $i ] , $body );
633
  $subject = str_replace( "**" . $headers[ $i ] . "**", $data[ $i ] , $subject );
634
  }
635
 
636
+ $body = wpautop( $body );
637
+
 
638
  $attachments = array();
639
  $attachment_id = get_option( 'acui_mail_attachment_id' );
640
  if( !empty( $attachment_id ) )
641
  $attachments[] = get_attached_file( $attachment_id );
642
 
643
+ $email_to = apply_filters( 'acui_import_email_to', $email, $headers, $data, $created );
644
+ $subject = apply_filters( 'acui_import_email_subject', $subject, $headers, $data, $created );
645
+ $body = apply_filters( 'acui_import_email_body', $body, $headers, $data, $created );
646
+ $headers_mail = apply_filters( 'acui_import_email_headers', array( 'Content-Type: text/html; charset=UTF-8' ), $headers, $data );
647
+ $attachments = apply_filters( 'acui_import_email_attachments', $attachments, $headers, $data, $created );
648
+
649
+ wp_mail( $email_to, $subject, $body, $headers_mail, $attachments );
650
  endif;
651
 
652
  endif;
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.4.1
7
- Stable tag: 1.15.6.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -99,6 +99,10 @@ Plugin will automatically detect:
99
 
100
  == Changelog ==
101
 
 
 
 
 
102
  = 1.15.6.5 =
103
  * Users only can import users with a role that they allowed to edit (thanks to @nonprofitweb https://wordpress.org/support/topic/import-user-with-higher-role/)
104
 
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.4.1
7
+ Stable tag: 1.15.6.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
99
 
100
  == Changelog ==
101
 
102
+ = 1.15.6.6 =
103
+ * Added multiple hooks to filter all about emails being sent when importing
104
+ * Included new variables in hooks that already exists in emails being sent when importing
105
+
106
  = 1.15.6.5 =
107
  * Users only can import users with a role that they allowed to edit (thanks to @nonprofitweb https://wordpress.org/support/topic/import-user-with-higher-role/)
108