Skip to content

Commit deac3f5

Browse files
committed
version 1.0.1 released with some cool new feature
1 parent 97f16c8 commit deac3f5

13 files changed

+720
-122
lines changed

README.txt

+14-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: codeboxr, manchumahara
33
Tags: email, log, email log, debug, email debug, email log
44
Requires at least: 3.0.1
55
Tested up to: 5.2.2
6-
Stable tag: 1.0.0
6+
Stable tag: 1.0.1
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

@@ -13,7 +13,14 @@ This plugin helps to log email and displays in admin panel and more.
1313

1414
This plugin helps to log any email sent from wordpress.
1515

16-
Main Features
16+
Main Features:
17+
18+
* Logs every email sent
19+
* Logs email send success or fail(Bullet proof way to detect email send or not)
20+
* Delete all email logs or single
21+
* View Email Log
22+
* View Email Preview
23+
* ReSend email from the list window
1724

1825

1926
== Installation ==
@@ -32,8 +39,12 @@ e.g.
3239
== Screenshots ==
3340

3441

35-
3642
== Changelog ==
43+
= 1.0.1 =
44+
* View Email Log
45+
* View Email Template in Popup
46+
* View Email log template in single view display
47+
* Single click resend email
3748

3849
= 1.0.0 =
3950
* First public release

admin/class-cbxwpemaillogger-admin.php

+90-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,25 @@ public function admin_pages() {
7575
* Admin listing menu callback
7676
*/
7777
public function display_cbxwpemaillogger_listing_page() {
78-
include( cbxwpemaillogger_locate_template('admin/cbxwpemaillogger-logs.php') );
78+
$view = isset($_REQUEST['view'])? esc_attr($_REQUEST['view']) : 'list';
79+
80+
81+
if($view == 'list'){
82+
include( cbxwpemaillogger_locate_template('admin/cbxwpemaillogger-logs.php') );
83+
}
84+
/*else if($view == 'body'){
85+
$log_id = isset($_REQUEST['log_id'])? intval($_REQUEST['log_id']) : 0;
86+
$item = CBXWPEmailLoggerHelper::SingleLog($log_id);
87+
include( cbxwpemaillogger_locate_template('admin/cbxwpemaillogger-body.php') );
88+
}*/
89+
else{
90+
$log_id = isset($_REQUEST['log_id'])? intval($_REQUEST['log_id']) : 0;
91+
92+
$item = CBXWPEmailLoggerHelper::SingleLog($log_id);
93+
94+
include( cbxwpemaillogger_locate_template('admin/cbxwpemaillogger-log.php') );
95+
}
96+
7997
}//end method display_cbxwpemaillogger_listing_page
8098

8199
/**
@@ -150,6 +168,7 @@ public function enqueue_scripts( $hook ) {
150168

151169
wp_localize_script( 'cbxwpemaillogger', 'cbxwpemaillogger_dashboard', apply_filters( 'cbxwpemaillogger_js_vars', $cbxwpemaillogger_js_vars ) );
152170

171+
add_thickbox();
153172

154173
wp_enqueue_script( 'jquery' );
155174
wp_enqueue_script( 'ply' );
@@ -177,6 +196,8 @@ public function insert_log( $atts ) {
177196

178197
$subject = isset( $atts['subject'] ) ? $atts['subject'] : '';
179198
$body = isset( $atts['message'] ) ? $atts['message'] : ( isset( $atts['html'] ) ? $atts['html'] : '' );
199+
//$htm
200+
180201
$headers = isset( $atts['headers'] ) ? $atts['headers'] : array();
181202
$attachments = isset( $atts['attachments'] ) ? $atts['attachments'] : array();
182203

@@ -468,7 +489,7 @@ public function email_log_delete(){
468489
check_ajax_referer( 'cbxwpemaillogger',
469490
'security' );
470491

471-
if ( is_user_logged_in() ) {
492+
if ( is_user_logged_in() && user_can( get_current_user_id(),'manage_options') ) {
472493
$id = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
473494

474495
if ( $id > 0 ) {
@@ -506,4 +527,71 @@ public function email_log_delete(){
506527
wp_send_json( $return );
507528

508529
}//end method email_log_delete
530+
531+
/**
532+
* Email log delete ajax handle
533+
*/
534+
public function email_resend(){
535+
check_ajax_referer( 'cbxwpemaillogger',
536+
'security' );
537+
538+
if ( is_user_logged_in() && user_can( get_current_user_id(),'manage_options') ) {
539+
$id = isset( $_POST['id'] ) ? intval( $_POST['id'] ) : 0;
540+
541+
if ( $id > 0 ) {
542+
global $wpdb;
543+
544+
545+
$item = CBXWPEmailLoggerHelper::SingleLog($id);
546+
547+
$email_data = maybe_unserialize( $item['email_data'] );
548+
549+
$atts = isset($email_data['atts'])? $email_data['atts']: array();
550+
551+
552+
553+
if(is_array($atts) && sizeof($atts) > 0){
554+
555+
//write_log($atts);
556+
557+
list($to, $subject, $message, $headers , $attachments) = array_values($atts);
558+
559+
$report = wp_mail($to, $subject, $message, $headers , $attachments);
560+
561+
if($report){
562+
$return = array(
563+
'message' => esc_html__( 'Email ReSend and Successfully sent.',
564+
'cbxwpemaillogger' ),
565+
'success' => 1,
566+
567+
);
568+
}
569+
else{
570+
$return = array(
571+
'message' => esc_html__( 'Email ReSend but failed.',
572+
'cbxwpemaillogger' ),
573+
'success' => 1,
574+
575+
);
576+
}
577+
578+
579+
580+
wp_send_json( $return );
581+
}
582+
583+
}
584+
}
585+
586+
$return = array(
587+
'message' => esc_html__( 'Failed to send or not enough access to send',
588+
'cbxwpemaillogger' ),
589+
'success' => 0,
590+
591+
);
592+
593+
wp_send_json( $return );
594+
595+
}//end method email_resend
596+
509597
}//end class CBXWPEmailLogger_Admin

assets/css/cbxwpemaillogger-admin.css

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
/**
22
* All of the CSS for your admin-specific functionality should be
33
* included in this file.
4-
*/
4+
*/
5+
6+
7+
8+
.cbxwpemaillogger_body {
9+
overflow: hidden;
10+
padding-top: 56.25%;
11+
position: relative;
12+
}
13+
14+
.cbxwpemaillogger_body iframe {
15+
border: 0;
16+
height: 100%;
17+
left: 0;
18+
position: absolute;
19+
top: 0;
20+
width: 100%;
21+
}
22+
23+
/* 4x3 Aspect Ratio */
24+
.cbxwpemaillogger_body-4x3 {
25+
padding-top: 75%;
26+
}

assets/js/cbxwpemaillogger-admin.js

+38-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
'use strict';
33

44
$(document).ready(function($) {
5+
//delete email log
56
$('.cbxwpemaillogger_actions_delete').on('click', function (e) {
67
e.preventDefault();
78

89
var $this = $(this);
9-
console.log($this);
10+
1011

1112
var $id = parseInt($this.data('id'));
1213
var $busy = parseInt($this.data('busy'));
@@ -57,6 +58,42 @@
5758

5859
}
5960
});//end ajax log delete
61+
62+
//re-send email
63+
$('.cbxwpemaillogger_actions_resend').on('click', function (e) {
64+
e.preventDefault();
65+
66+
var $this = $(this);
67+
68+
69+
var $id = parseInt($this.data('id'));
70+
var $busy = parseInt($this.data('busy'));
71+
72+
if($busy == 0){
73+
74+
// Ok
75+
//send ajax request to delete
76+
$this.data('busy', 1);
77+
78+
$.ajax({
79+
80+
type: "post",
81+
dataType: "json",
82+
url: cbxwpemaillogger_dashboard.ajaxurl,
83+
data: {
84+
action: "cbxwpemaillogger_log_resend",
85+
id: $id,
86+
security: cbxwpemaillogger_dashboard.nonce
87+
},
88+
success: function (data, textStatus, XMLHttpRequest) {
89+
$this.data('busy', 0);
90+
91+
Ply.dialog("alert", data.message);
92+
}
93+
});
94+
95+
}
96+
});//end ajax email resend
6097
});
6198

6299
})( jQuery );

cbxwpemaillogger.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Plugin Name: CBX Email Logger
1717
* Plugin URI: https://codeboxr.com/product/cbx-email-logger-for-wordpress/
1818
* Description: Logs email, tracks sent or failed status and more.
19-
* Version: 1.0.0
19+
* Version: 1.0.1
2020
* Author: Codeboxr
2121
* Author URI: https://codeboxr.com
2222
* License: GPL-2.0+
@@ -31,7 +31,7 @@
3131
}
3232

3333
defined( 'CBXWPEMAILLOGGER_PLUGIN_NAME' ) or define( 'CBXWPEMAILLOGGER_PLUGIN_NAME', 'cbxwpemaillogger' );
34-
defined( 'CBXWPEMAILLOGGER_PLUGIN_VERSION' ) or define( 'CBXWPEMAILLOGGER_PLUGIN_VERSION', '1.0.0' );
34+
defined( 'CBXWPEMAILLOGGER_PLUGIN_VERSION' ) or define( 'CBXWPEMAILLOGGER_PLUGIN_VERSION', '1.0.1' );
3535
defined( 'CBXWPEMAILLOGGER_BASE_NAME' ) or define( 'CBXWPEMAILLOGGER_BASE_NAME', plugin_basename( __FILE__ ) );
3636
defined( 'CBXWPEMAILLOGGER_ROOT_PATH' ) or define( 'CBXWPEMAILLOGGER_ROOT_PATH', plugin_dir_path( __FILE__ ) );
3737
defined( 'CBXWPEMAILLOGGER_ROOT_URL' ) or define( 'CBXWPEMAILLOGGER_ROOT_URL', plugin_dir_url( __FILE__ ) );

includes/class-cbxwpemaillogger-deactivator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ public static function deactivate() {
3333

3434
}
3535

36-
}
36+
}//end class CBXWPEmailLogger_Deactivator

includes/class-cbxwpemaillogger-helper.php

-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public static function SingleLog( $log_id = 0 ) {
9797
$sql_select = "SELECT log.* FROM $table_cbxwpemaillogger AS log";
9898

9999
$log = $wpdb->get_row( "$sql_select WHERE $where_sql ", 'ARRAY_A' );
100-
101100
}
102101

103102
return $log;

0 commit comments

Comments
 (0)