Changeset 751406
- Timestamp:
- 08/05/2013 04:46:45 AM (13 years ago)
- Location:
- email/trunk
- Files:
-
- 4 edited
-
admin.php (modified) (2 diffs)
-
email.php (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
router.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
email/trunk/admin.php
r751115 r751406 71 71 register_post_type( 'email_log', $args ); 72 72 73 register_post_status( 'error', array( 74 'label' => _x( 'Error', 'email' ), 75 'public' => false, 76 'label_count' => _n_noop( 'Errors <span class="count">(%s)</span>', 'Errors <span class="count">(%s)</span>' ) 77 ) ); 78 73 79 } 74 80 … … 140 146 <?php 141 147 142 $actions = array( 'new', 'updated' );148 $actions = array( 'new', 'updated', 'deleted' ); 143 149 $types = get_post_types(); 144 150 -
email/trunk/email.php
r751120 r751406 4 4 * Description: Email users with custom templates when certain actions happen, such as new posts, updated custom post types, deleted users. 5 5 * Author: developdaly 6 * Version: 1. 0.36 * Version: 1.1 7 7 * Author URI: http://developdaly.com/ 8 8 * Text Domain: email -
email/trunk/readme.txt
r751120 r751406 4 4 Requires at least: 3.5.2 5 5 Tested up to: 3.6 6 Stable tag: 1. 0.36 Stable tag: 1.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 12 12 == Description == 13 13 14 [**Contribute on Github**](https://github.com/developdaly/Email) | [**Report Bugs**](https://github.com/developdaly/Email/issues?labels=bug&milestone=&page=1&state=open) 15 14 16 This plugin allows you configure and reconfigure emails that are sent to specified users when certain things happen. 15 17 … … 18 20 * new post 19 21 * updated post 22 * deleted post 20 23 * (more coming soon) 21 24 … … 34 37 == Changelog == 35 38 36 = 1.0.3 = 37 * Version bump 39 = 1.1 = 40 * Fixes issue where emails were not sending for the "new" action 41 * Fixes issue where emails were attempting to send (but failing in most cases) for all posts types, even if not specified by the rule 42 * Adds logging of failed emails 38 43 39 44 = 1.0.2 = -
email/trunk/router.php
r751111 r751406 19 19 20 20 $email_action = get_post_meta( $email->ID, 'email_action', true ); 21 $email_type = get_post_meta( $email->ID, 'email_type', true ); 21 22 22 if ( ($new_status != $old_status) && ( $email_action == 'new' ) && ( 'new' == $new_status ) ) { 23 email_action( 'new', $post->ID, $email->ID ); 23 if( $email_type != $post->post_type ) 24 return; 25 26 if ( ($new_status != $old_status) && ( $email_action == 'new' ) && ( 'publish' == $new_status ) ) { 27 email_action( 'new', $post->ID, $email->ID, $old_status, $new_status ); 24 28 } 25 29 26 if ( ($new_status == $old_status) && ( $email_action == 'updated' ) ) {30 elseif ( ($new_status == $old_status) && ( $email_action == 'updated' ) ) { 27 31 email_action( 'updated', $post->ID, $email->ID, $old_status, $new_status ); 32 } 33 34 elseif ( ($new_status != $old_status) && ( $email_action == 'deleted' ) && ( 'trash' == $new_status ) ) { 35 email_action( 'deleted', $post->ID, $email->ID, $old_status, $new_status ); 28 36 } 29 37 … … 99 107 $mail = wp_mail( $users_to_list, $parsed_subject, $parsed_message, $headers ); 100 108 109 // Log successful email 101 110 if( $mail ) { 102 111 103 112 $args = array( 113 'post_content' => $parsed_message, 114 'post_status' => 'private', 104 115 'post_title' => $parsed_subject, 105 'post_type' => 'email_log', 106 'post_content' => $parsed_message 116 'post_type' => 'email_log' 117 ); 118 $log_id = wp_insert_post( $args ); 119 120 foreach( $headers as $key => $val ) { 121 update_post_meta( $log_id, $key, $val ); 122 } 123 } else { 124 // Log unsuccessful email 125 $args = array( 126 'post_content' => $parsed_message, 127 'post_status' => 'error', 128 'post_title' => '[FAILED to send "'. $action .'" email] '. $parsed_subject, 129 'post_type' => 'email_log' 107 130 ); 108 131 $log_id = wp_insert_post( $args );
Note: See TracChangeset
for help on using the changeset viewer.