Plugin Directory

Changeset 2797606


Ignore:
Timestamp:
10/12/2022 06:56:47 AM (3 years ago)
Author:
ringier
Message:

New release v1.3.0 | see changelog

Location:
ringier-bus/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ringier-bus/trunk/CHANGELOG.md

    r2793833 r2797606  
    11# Changelog Details
    22
     3### 1.3.0 (Oct 12, 2022) ###
     4* [NEW] custom post_type event | handle triggering of events separately for custom post_type
     5* [NEW] custom fields on admin UI | allow showing of acf custom fields on custom post_type as well, excluding page for now
     6
    37### 1.2.0 (Oct 04, 2022) ###
    4 
    58* [FIX] Events should not be triggered when "saving draft"
    69* [NEW] Logging | Add additional log message when an Event is not sent to know why
  • ringier-bus/trunk/README.md

    r2793833 r2797606  
    77**Requires at least:** 5.7.0 
    88**Tested up to:** 6.0.2 
    9 **Stable tag:** 1.2.0 
     9**Stable tag:** 1.3.0 
    1010**License:** GPLv2 or later 
    1111**License URI:** http://www.gnu.org/licenses/gpl-2.0.html 
  • ringier-bus/trunk/readme.txt

    r2793833 r2797606  
    44Requires at least: 4.7
    55Tested up to: 6.0.2
    6 Stable tag: 1.2.0
     6Stable tag: 1.3.0
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    6868== Changelog ==
    6969
     70### 1.3.0 (Oct 12, 2022) ###
     71* [NEW] custom post_type event | handle triggering of events separately for custom post_type
     72* [NEW] custom fields on admin UI | allow showing of acf custom fields on custom post_type as well, excluding page for now
     73
     74### 1.2.0 (Oct 04, 2022) ###
     75* [FIX] Events should not be triggered when "saving draft"
     76* [NEW] Logging | Add additional log message when an Event is not sent to know why
     77* [NEW] Addition of new logic for new field: primary_media_type
     78
    7079### 1.1.1 (Aug 16, 2022) ###
    7180* [JSON Request] The API's field `description` field truncated to 2500 chars since the BUS API request will fail on more than 3000 chars.
  • ringier-bus/trunk/ringier-bus.php

    r2793833 r2797606  
    1111 * Plugin URI: https://github.com/RingierIMU/mkt-plugin-wordpress-bus
    1212 * Description: A plugin to push events to Ringier CDE via the BUS API whenever an article is created, updated or deleted
    13  * Version: 1.2.0
     13 * Version: 1.3.0
    1414 * Requires at least: 4.7.0
    1515 * Author: Ringier SA, Wasseem Khayrattee
     
    5050 */
    5151define('RINGIER_BUS_DS', DIRECTORY_SEPARATOR);
    52 define('RINGIER_BUS_PLUGIN_VERSION', '1.2.0');
     52define('RINGIER_BUS_PLUGIN_VERSION', '1.3.0');
    5353define('RINGIER_BUS_PLUGIN_MINIMUM_WP_VERSION', '4.7');
    5454define('RINGIER_BUS_PLUGIN_DIR_URL', plugin_dir_url(__FILE__)); //has trailing slash at end
  • ringier-bus/trunk/src/Core/Bus/BusHelper.php

    r2793833 r2797606  
    4949        //Register Bus Events ONLY IF it is enabled
    5050        if ($fieldsObject->is_bus_enabled === true) {
     51            add_action('transition_post_status', [self::class, 'cater_for_custom_post'], 10, 3);
    5152            add_action('rest_after_insert_post', [self::class, 'triggerArticleEvent'], 10, 1);
    5253            add_action('publish_to_trash', [self::class, 'triggerArticleDeletedEvent'], 10, 3);
    5354            add_action(Enum::HOOK_NAME_SCHEDULED_EVENTS, [self::class, 'cronSendToBusScheduled'], 10, 3);
    5455        }
     56    }
     57
     58    /**
     59     * To cater for custom post_type only
     60     *
     61     * @param $new_status
     62     * @param $old_status
     63     * @param $post
     64     */
     65    public function cater_for_custom_post($new_status, $old_status, $post)
     66    {
     67        //bail if a page
     68        if (strcmp($post->post_type, 'page') == 0) {
     69            return;
     70        }
     71        //bail is normal post, we are catering for custom posts
     72        if (strcmp($post->post_type, 'post') == 0) {
     73            return;
     74        }
     75        if (empty($post->post_type)) {
     76            return;
     77        }
     78
     79        // Bail if we're working on a draft or trashed item
     80        if ($new_status == 'auto-draft' || $new_status == 'draft' || $new_status == 'inherit' || $new_status == 'trash') {
     81            return;
     82        }
     83
     84//        ringier_errorlogthis('post_type for this trigger: ' . print_r($post->post_type, true));
     85        add_action('rest_after_insert_' . trim($post->post_type), [self::class, 'triggerArticleEvent'], 15, 1);
     86
     87        return;
    5588    }
    5689
  • ringier-bus/trunk/src/Core/BusPluginClass.php

    r2709549 r2797606  
    243243                    [
    244244                        'param' => 'post_type',
    245                         'operator' => '==',
    246                         'value' => 'post',
     245                        'operator' => '!=',
     246                        'value' => 'page',
    247247                    ],
    248248                ],
Note: See TracChangeset for help on using the changeset viewer.