Changeset 3444459
- Timestamp:
- 01/21/2026 11:13:43 PM (2 months ago)
- Location:
- smart-renew-tracker
- Files:
-
- 2 edited
- 1 copied
-
tags/1.1.1 (copied) (copied from smart-renew-tracker/trunk)
-
tags/1.1.1/includes/email-notifications.php (modified) (2 diffs)
-
trunk/includes/email-notifications.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
smart-renew-tracker/tags/1.1.1/includes/email-notifications.php
r3444424 r3444459 11 11 } 12 12 13 // متد جدید برای دکمه تست14 13 public function handle_test_email_ajax() { 15 // چک کردن امنیت16 14 if ( ! current_user_can( 'manage_options' ) || ! check_ajax_referer( 'smartrt_test_nonce', 'nonce', false ) ) { 17 15 wp_send_json_error( __( 'Permission denied.', 'smart-renew-tracker' ) ); … … 57 55 58 56 public function process_notifications() { 59 // کدهای قبلی متد پروسس... 57 $alert_days = get_option( 'smartrt_alert_days', 7 ); 58 $target_email = get_option( 'smartrt_target_email', get_option( 'admin_email' ) ); 59 $today = current_time( 'timestamp' ); 60 61 // ۲. کوئری برای پیدا کردن تمام موارد ثبت شده 62 $query = new \WP_Query( [ 63 'post_type' => 'smartrt_renewal', 64 'posts_per_page' => -1, 65 'post_status' => 'publish', 66 ] ); 67 68 $expiring_items = []; 69 70 foreach ( $query->posts as $renewal ) { 71 $renewal_date = get_post_meta( $renewal->ID, '_smartrt_renewal_date', true ); 72 if ( ! $renewal_date ) continue; 73 74 $diff = ceil( ( strtotime( $renewal_date ) - $today ) / DAY_IN_SECONDS ); 75 76 // اگر مورد در بازه هشدار (مثلاً ۷ روز مانده) باشد 77 if ( $diff <= $alert_days && $diff >= 0 ) { 78 $expiring_items[] = [ 79 'title' => get_the_title( $renewal->ID ), 80 'days' => $diff, 81 'date' => $renewal_date, 82 'type' => get_post_meta( $renewal->ID, '_smartrt_type', true ) 83 ]; 84 } 85 } 86 87 if ( ! empty( $expiring_items ) ) { 88 $this->send_html_email( $target_email, $expiring_items ); 89 } 60 90 } 61 91 } 92 93 new Email_Notifications(); -
smart-renew-tracker/trunk/includes/email-notifications.php
r3444424 r3444459 11 11 } 12 12 13 // متد جدید برای دکمه تست14 13 public function handle_test_email_ajax() { 15 // چک کردن امنیت16 14 if ( ! current_user_can( 'manage_options' ) || ! check_ajax_referer( 'smartrt_test_nonce', 'nonce', false ) ) { 17 15 wp_send_json_error( __( 'Permission denied.', 'smart-renew-tracker' ) ); … … 57 55 58 56 public function process_notifications() { 59 // کدهای قبلی متد پروسس... 57 $alert_days = get_option( 'smartrt_alert_days', 7 ); 58 $target_email = get_option( 'smartrt_target_email', get_option( 'admin_email' ) ); 59 $today = current_time( 'timestamp' ); 60 61 // ۲. کوئری برای پیدا کردن تمام موارد ثبت شده 62 $query = new \WP_Query( [ 63 'post_type' => 'smartrt_renewal', 64 'posts_per_page' => -1, 65 'post_status' => 'publish', 66 ] ); 67 68 $expiring_items = []; 69 70 foreach ( $query->posts as $renewal ) { 71 $renewal_date = get_post_meta( $renewal->ID, '_smartrt_renewal_date', true ); 72 if ( ! $renewal_date ) continue; 73 74 $diff = ceil( ( strtotime( $renewal_date ) - $today ) / DAY_IN_SECONDS ); 75 76 // اگر مورد در بازه هشدار (مثلاً ۷ روز مانده) باشد 77 if ( $diff <= $alert_days && $diff >= 0 ) { 78 $expiring_items[] = [ 79 'title' => get_the_title( $renewal->ID ), 80 'days' => $diff, 81 'date' => $renewal_date, 82 'type' => get_post_meta( $renewal->ID, '_smartrt_type', true ) 83 ]; 84 } 85 } 86 87 if ( ! empty( $expiring_items ) ) { 88 $this->send_html_email( $target_email, $expiring_items ); 89 } 60 90 } 61 91 } 92 93 new Email_Notifications();
Note: See TracChangeset
for help on using the changeset viewer.