Version Description
- Attachments in email templates and mail options now can be deleted thanks to Joel Frankwick
Download this release
Release Info
Developer | carazo |
Plugin | Import users from CSV with meta |
Version | 1.13.2 |
Comparing to | |
See all releases |
Code changes from version 1.13.1 to 1.13.2
- assets/email-template-attachment-admin.js +55 -3
- classes/email-options.php +31 -41
- classes/email-templates.php +1 -17
- import-users-from-csv-with-meta.php +1 -1
- importer.php +1 -1
- readme.txt +4 -1
assets/email-template-attachment-admin.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
'use strict';
|
3 |
var attachmentFrame;
|
4 |
|
5 |
-
$( '#acui_email_template_upload_button' ).click(function(e) {
|
6 |
var btn = e.target;
|
7 |
|
8 |
if ( !btn ) return;
|
@@ -10,8 +10,8 @@
|
|
10 |
e.preventDefault();
|
11 |
|
12 |
attachmentFrame = wp.media.frames.attachmentFrame = wp.media({
|
13 |
-
title:
|
14 |
-
button: { text:
|
15 |
});
|
16 |
|
17 |
attachmentFrame.on('select', function() {
|
@@ -23,4 +23,56 @@
|
|
23 |
|
24 |
attachmentFrame.open();
|
25 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
});
|
2 |
'use strict';
|
3 |
var attachmentFrame;
|
4 |
|
5 |
+
$( '#acui_email_option_upload_button,#acui_email_template_upload_button' ).click(function(e) {
|
6 |
var btn = e.target;
|
7 |
|
8 |
if ( !btn ) return;
|
10 |
e.preventDefault();
|
11 |
|
12 |
attachmentFrame = wp.media.frames.attachmentFrame = wp.media({
|
13 |
+
title: email_template_attachment_admin.title,
|
14 |
+
button: { text: email_template_attachment_admin.button },
|
15 |
});
|
16 |
|
17 |
attachmentFrame.on('select', function() {
|
23 |
|
24 |
attachmentFrame.open();
|
25 |
});
|
26 |
+
|
27 |
+
$( '#enable_email_templates' ).change( function(){
|
28 |
+
var enable = $( this ).is( ':checked' );
|
29 |
+
var data = {
|
30 |
+
'action': 'acui_refresh_enable_email_templates',
|
31 |
+
'enable': enable,
|
32 |
+
'security': email_template_attachment_admin.nonce,
|
33 |
+
};
|
34 |
+
|
35 |
+
$.post( ajaxurl, data, function( response ) {
|
36 |
+
location.reload();
|
37 |
+
});
|
38 |
+
} );
|
39 |
+
|
40 |
+
$( '#load_email_template' ).click( function(){
|
41 |
+
if( $( '#email_template_selected' ).val() == '' )
|
42 |
+
return;
|
43 |
+
|
44 |
+
var data = {
|
45 |
+
'action': 'acui_email_template_selected',
|
46 |
+
'email_template_selected': $( '#email_template_selected' ).val(),
|
47 |
+
'security': email_template_attachment_admin.nonce,
|
48 |
+
};
|
49 |
+
|
50 |
+
$.post( ajaxurl, data, function( response ) {
|
51 |
+
var response = JSON.parse( response );
|
52 |
+
$( '#title' ).val( response.title );
|
53 |
+
tinyMCE.get( 'body_mail' ).setContent( response.content );
|
54 |
+
$( '#email_template_attachment_id' ).val( response.attachment_id );
|
55 |
+
if( response.attachment_url != '' ){
|
56 |
+
$( '#email_template_attachment_file' ).val( response.attachment_url );
|
57 |
+
}
|
58 |
+
$( '#template_id' ).val( response.id );
|
59 |
+
$( '#save_mail_template_options' ).click();
|
60 |
+
});
|
61 |
+
} );
|
62 |
+
|
63 |
+
$( '#acui_email_option_remove_upload_button' ).click( function(){
|
64 |
+
var data = {
|
65 |
+
'action': 'acui_mail_options_remove_attachment',
|
66 |
+
'security': email_template_attachment_admin.nonce,
|
67 |
+
};
|
68 |
+
|
69 |
+
$.post( ajaxurl, data, function( response ) {
|
70 |
+
location.reload();
|
71 |
+
});
|
72 |
+
} );
|
73 |
+
|
74 |
+
$( '#acui_email_template_remove_upload_button' ).click( function(){
|
75 |
+
$( '#email_template_attachment_file' ).val( '' );
|
76 |
+
$( '#email_template_attachment_id' ).val( '' );
|
77 |
+
} );
|
78 |
});
|
classes/email-options.php
CHANGED
@@ -3,6 +3,11 @@
|
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
5 |
class ACUI_Email_Options{
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function admin_gui(){
|
7 |
$from_email = get_option( "acui_mail_from" );
|
8 |
$from_name = get_option( "acui_mail_from_name" );
|
@@ -69,7 +74,8 @@ class ACUI_Email_Options{
|
|
69 |
<label for="email_template_attachment_file"><?php _e( 'Attachment', 'import-users-from-csv-with-meta' )?></label><br>
|
70 |
<input type="url" class="large-text" name="email_template_attachment_file" id="email_template_attachment_file" value="<?php echo wp_get_attachment_url( $attachment_id ); ?>" readonly/><br>
|
71 |
<input type="hidden" name="email_template_attachment_id" id="email_template_attachment_id" value="<?php echo $attachment_id ?>"/>
|
72 |
-
<button type="button" class="button" id="
|
|
|
73 |
</div>
|
74 |
</fieldset>
|
75 |
|
@@ -79,46 +85,30 @@ class ACUI_Email_Options{
|
|
79 |
<?php ACUI_Email_Template::email_templates_edit_form_after_editor(); ?>
|
80 |
|
81 |
</form>
|
|
|
|
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
if( $( '#email_template_selected' ).val() == '' )
|
100 |
-
return;
|
101 |
-
|
102 |
-
var data = {
|
103 |
-
'action': 'acui_email_template_selected',
|
104 |
-
'email_template_selected': $( '#email_template_selected' ).val(),
|
105 |
-
'security': '<?php echo wp_create_nonce( "codection-security" ); ?>',
|
106 |
-
};
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
tinyMCE.get( 'body_mail' ).setContent( response.content );
|
112 |
-
$( '#email_template_attachment_id' ).val( response.attachment_id );
|
113 |
-
if( response.attachment_url != '' ){
|
114 |
-
$( '#email_template_attachment_file' ).val( response.attachment_url );
|
115 |
-
}
|
116 |
-
$( '#template_id' ).val( response.id );
|
117 |
-
$( '#save_mail_template_options' ).click();
|
118 |
-
});
|
119 |
-
} );
|
120 |
-
} );
|
121 |
-
</script>
|
122 |
-
<?php
|
123 |
}
|
124 |
-
}
|
|
|
|
3 |
if ( ! defined( 'ABSPATH' ) ) exit;
|
4 |
|
5 |
class ACUI_Email_Options{
|
6 |
+
function __construct(){
|
7 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ), 10, 1 );
|
8 |
+
add_action( 'wp_ajax_acui_mail_options_remove_attachment', array( $this, 'ajax_remove_attachment' ) );
|
9 |
+
}
|
10 |
+
|
11 |
public static function admin_gui(){
|
12 |
$from_email = get_option( "acui_mail_from" );
|
13 |
$from_name = get_option( "acui_mail_from_name" );
|
74 |
<label for="email_template_attachment_file"><?php _e( 'Attachment', 'import-users-from-csv-with-meta' )?></label><br>
|
75 |
<input type="url" class="large-text" name="email_template_attachment_file" id="email_template_attachment_file" value="<?php echo wp_get_attachment_url( $attachment_id ); ?>" readonly/><br>
|
76 |
<input type="hidden" name="email_template_attachment_id" id="email_template_attachment_id" value="<?php echo $attachment_id ?>"/>
|
77 |
+
<button type="button" class="button" id="acui_email_option_upload_button"><?php _e( 'Upload file', 'import-users-from-csv-with-meta' )?></button>
|
78 |
+
<button type="button" class="button" id="acui_email_option_remove_upload_button"><?php _e( 'Remove file', 'import-users-from-csv-with-meta' )?></button>
|
79 |
</div>
|
80 |
</fieldset>
|
81 |
|
85 |
<?php ACUI_Email_Template::email_templates_edit_form_after_editor(); ?>
|
86 |
|
87 |
</form>
|
88 |
+
<?php
|
89 |
+
}
|
90 |
|
91 |
+
function load_scripts( $hook ) {
|
92 |
+
global $typenow, $acui_url_plugin;
|
93 |
+
|
94 |
+
if( $typenow == 'acui_email_template' || $hook == 'tools_page_acui' ) {
|
95 |
+
wp_enqueue_media();
|
96 |
+
wp_register_script( 'email-template-attachment-admin', $acui_url_plugin . '/assets/email-template-attachment-admin.js', array( 'jquery' ) );
|
97 |
+
wp_localize_script( 'email-template-attachment-admin', 'email_template_attachment_admin',
|
98 |
+
array(
|
99 |
+
'title' => __( 'Choose or upload file', 'import-users-from-csv-with-meta' ),
|
100 |
+
'button' => __( 'Use this file', 'import-users-from-csv-with-meta' ),
|
101 |
+
'nonce' => wp_create_nonce( "codection-security" )
|
102 |
+
)
|
103 |
+
);
|
104 |
+
wp_enqueue_script( 'email-template-attachment-admin' );
|
105 |
+
}
|
106 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
+
function ajax_remove_attachment(){
|
109 |
+
check_ajax_referer( 'codection-security', 'security' );
|
110 |
+
update_option( "acui_mail_attachment_id", "" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
+
}
|
113 |
+
|
114 |
+
new ACUI_Email_Options();
|
classes/email-templates.php
CHANGED
@@ -9,7 +9,6 @@ class ACUI_Email_Template{
|
|
9 |
add_action( 'wp_ajax_acui_refresh_enable_email_templates', array( $this, 'refresh_enable_email_templates' ) );
|
10 |
add_action( 'wp_ajax_acui_email_template_selected', array( $this, 'email_template_selected' ) );
|
11 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
12 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'load_admin_scripts' ), 10, 1 );
|
13 |
add_action( 'save_post', array( $this, 'save_post' ) );
|
14 |
}
|
15 |
|
@@ -118,22 +117,6 @@ class ACUI_Email_Template{
|
|
118 |
'core' );
|
119 |
}
|
120 |
|
121 |
-
function load_admin_scripts( $hook ) {
|
122 |
-
global $typenow, $acui_url_plugin;
|
123 |
-
|
124 |
-
if( $typenow == 'acui_email_template' || $hook == 'tools_page_acui' ) {
|
125 |
-
wp_enqueue_media();
|
126 |
-
wp_register_script( 'meta-box-image', $acui_url_plugin . '/assets/email-template-attachment-admin.js', array( 'jquery' ) );
|
127 |
-
wp_localize_script( 'meta-box-image', 'meta_image',
|
128 |
-
array(
|
129 |
-
'title' => __( 'Choose or upload file', 'import-users-from-csv-with-meta' ),
|
130 |
-
'button' => __( 'Use this file', 'import-users-from-csv-with-meta' ),
|
131 |
-
)
|
132 |
-
);
|
133 |
-
wp_enqueue_script( 'meta-box-image' );
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
public function email_template_attachments( $post ){
|
138 |
$email_template_attachment_id = get_post_meta( $post->ID, 'email_template_attachment_id', true );
|
139 |
?>
|
@@ -143,6 +126,7 @@ class ACUI_Email_Template{
|
|
143 |
<input type="url" class="large-text" name="email_template_attachment_file" id="email_template_attachment_file" value="<?php echo wp_get_attachment_url( $email_template_attachment_id ); ?>" readonly/><br>
|
144 |
<input type="hidden" name="email_template_attachment_id" id="email_template_attachment_id" value="<?php echo $email_template_attachment_id ?>"/>
|
145 |
<button type="button" class="button" id="acui_email_template_upload_button"><?php _e( 'Upload file', 'import-users-from-csv-with-meta' )?></button>
|
|
|
146 |
</div>
|
147 |
</fieldset>
|
148 |
<?php
|
9 |
add_action( 'wp_ajax_acui_refresh_enable_email_templates', array( $this, 'refresh_enable_email_templates' ) );
|
10 |
add_action( 'wp_ajax_acui_email_template_selected', array( $this, 'email_template_selected' ) );
|
11 |
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
|
|
|
12 |
add_action( 'save_post', array( $this, 'save_post' ) );
|
13 |
}
|
14 |
|
117 |
'core' );
|
118 |
}
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
public function email_template_attachments( $post ){
|
121 |
$email_template_attachment_id = get_post_meta( $post->ID, 'email_template_attachment_id', true );
|
122 |
?>
|
126 |
<input type="url" class="large-text" name="email_template_attachment_file" id="email_template_attachment_file" value="<?php echo wp_get_attachment_url( $email_template_attachment_id ); ?>" readonly/><br>
|
127 |
<input type="hidden" name="email_template_attachment_id" id="email_template_attachment_id" value="<?php echo $email_template_attachment_id ?>"/>
|
128 |
<button type="button" class="button" id="acui_email_template_upload_button"><?php _e( 'Upload file', 'import-users-from-csv-with-meta' )?></button>
|
129 |
+
<button type="button" class="button" id="acui_email_template_remove_upload_button"><?php _e( 'Remove file', 'import-users-from-csv-with-meta' )?></button>
|
130 |
</div>
|
131 |
</fieldset>
|
132 |
<?php
|
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.13.
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
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.13.2
|
7 |
Author: codection
|
8 |
Author URI: https://codection.com
|
9 |
License: GPL2
|
importer.php
CHANGED
@@ -596,7 +596,7 @@ function acui_import_users( $file, $form_data, $attach_id = 0, $is_cron = false,
|
|
596 |
|
597 |
$attachments = array();
|
598 |
$attachment_id = get_option( 'acui_mail_attachment_id' );
|
599 |
-
if( $attachment_id
|
600 |
$attachments[] = get_attached_file( $attachment_id );
|
601 |
|
602 |
add_filter( 'wp_mail_content_type', 'cod_set_html_content_type' );
|
596 |
|
597 |
$attachments = array();
|
598 |
$attachment_id = get_option( 'acui_mail_attachment_id' );
|
599 |
+
if( !empty( $attachment_id ) )
|
600 |
$attachments[] = get_attached_file( $attachment_id );
|
601 |
|
602 |
add_filter( 'wp_mail_content_type', 'cod_set_html_content_type' );
|
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: 5.1
|
7 |
-
Stable tag: 1.13.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -74,6 +74,9 @@ Plugin will automatically detect:
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
77 |
= 1.13.1 =
|
78 |
* Email templates loads also the attachment in Mail options when they are selected thanks to Joel Frankwick
|
79 |
|
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.1
|
7 |
+
Stable tag: 1.13.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.13.2 =
|
78 |
+
* Attachments in email templates and mail options now can be deleted thanks to Joel Frankwick
|
79 |
+
|
80 |
= 1.13.1 =
|
81 |
* Email templates loads also the attachment in Mail options when they are selected thanks to Joel Frankwick
|
82 |
|