Changeset 3490668
- Timestamp:
- 03/25/2026 09:05:11 AM (4 days ago)
- Location:
- notify-events/trunk
- Files:
-
- 6 edited
-
modules/woocommerce/models/events/order/NewOrder.php (modified) (1 diff)
-
modules/woocommerce/models/events/product/ProductAdded.php (modified) (1 diff)
-
modules/wordpress/models/events/post/PostAdded.php (modified) (1 diff)
-
modules/wordpress/views/event/post_custom.php (modified) (2 diffs)
-
notify-events.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
notify-events/trunk/modules/woocommerce/models/events/order/NewOrder.php
r2432603 r3490668 29 29 { 30 30 add_action('woocommerce_checkout_order_processed', static::class . '::handle', 10, 3); 31 // Блочный чекаут (WooCommerce 8.3+) передаёт только объект заказа 32 add_action('woocommerce_store_api_checkout_order_processed', static::class . '::handle_block', 10, 1); 33 } 34 35 /** 36 * Обработчик для блочного чекаута (Gutenberg block checkout). 37 * Хук woocommerce_store_api_checkout_order_processed передаёт только $order. 38 * 39 * @param WC_Order $order 40 * @throws ErrorException 41 */ 42 public static function handle_block($order) 43 { 44 static::handle($order->get_id(), [], $order); 31 45 } 32 46 -
notify-events/trunk/modules/woocommerce/models/events/product/ProductAdded.php
r2919893 r3490668 26 26 public static function register() 27 27 { 28 add_action('wp_insert_post', static::class . '::handle', 10, 3); 28 // transition_post_status позволяет точно определить первое ручное сохранение: 29 // - auto-draft → draft: WP 3.6+, открытие редактора создаёт auto-draft, пользователь сохраняет черновик 30 // - new → draft: WP < 3.6, продукт создаётся только в момент первого сохранения 31 add_action('transition_post_status', static::class . '::handle', 10, 3); 29 32 } 30 33 31 34 /** 32 * @param int $post_id 35 * @param string $new_status 36 * @param string $old_status 33 37 * @param WP_Post $post 34 * @param bool $update35 38 * @throws ErrorException 36 39 */ 37 public static function handle($ post_id, $post, $update)40 public static function handle($new_status, $old_status, $post) 38 41 { 39 if ($ update) {42 if ($new_status !== 'draft' || !in_array($old_status, ['auto-draft', 'new'], true)) { 40 43 return; 41 44 } 42 45 43 if ($post->post_type != 'product') {46 if ($post->post_type !== 'product') { 44 47 return; 45 48 } -
notify-events/trunk/modules/wordpress/models/events/post/PostAdded.php
r2432603 r3490668 26 26 public static function register() 27 27 { 28 add_action('wp_insert_post', static::class . '::handle', 10, 3); 28 // transition_post_status позволяет точно определить первое ручное сохранение: 29 // - auto-draft → draft: WP 3.6+, открытие редактора создаёт auto-draft, пользователь сохраняет черновик 30 // - new → draft: WP < 3.6, пост создаётся только в момент первого сохранения 31 add_action('transition_post_status', static::class . '::handle', 10, 3); 29 32 } 30 33 31 34 /** 32 * @param int $post_id 35 * @param string $new_status 36 * @param string $old_status 33 37 * @param WP_Post $post 34 * @param bool $update35 38 * @throws ErrorException 36 39 */ 37 public static function handle($ post_id, $post, $update)40 public static function handle($new_status, $old_status, $post) 38 41 { 39 if ($ update) {42 if ($new_status !== 'draft' || !in_array($old_status, ['auto-draft', 'new'], true)) { 40 43 return; 41 44 } 42 45 43 if ($post->post_type != 'post') {46 if ($post->post_type !== 'post') { 44 47 return; 45 48 } -
notify-events/trunk/modules/wordpress/views/event/post_custom.php
r2919893 r3490668 38 38 <?= $this->render('form/_multi_select', [ 39 39 'model' => $event, 40 'title' => __(' PostType', WPNE),40 'title' => __('Type', WPNE), 41 41 'field' => 'post_type', 42 42 'items' => $event::post_type_list(), … … 49 49 <?= $this->render('form/_multi_select', [ 50 50 'model' => $event, 51 'title' => __('Old Type', WPNE),51 'title' => __('Old Status', WPNE), 52 52 'field' => 'post_old_status', 53 53 'items' => $event::post_status_list(), -
notify-events/trunk/notify-events.php
r3489780 r3490668 6 6 Author: Notify.Events 7 7 Author URI: https://notify.events/ 8 Version: 1.4. 38 Version: 1.4.4 9 9 License: GPL-2.0 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
notify-events/trunk/readme.txt
r3489780 r3490668 5 5 Requires PHP: 5.6 6 6 Tested up to: 7.0 7 Stable tag: 1.4. 37 Stable tag: 1.4.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.