Custom handling of imported items

Home Forums Calendar Products Event Aggregator Custom handling of imported items

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1211497
    Lisa
    Participant

    Trying to find a new way to import items using the aggregator and mark a specific event promoted or featured.

    The original iCal importer allowed for the filtering of the stati list get_possible_stati() returned. For specific imports I was able to specify ‘Promoted’ for the status which could be used to do some additional actions when saving the event marking those events as promoted. This is now failing in the new aggregator. The list of stati are now acquired using get_post_statuses which returns a hard coded list with out any way to filter them. Another option would be to add a custom taxonomy selector near the Status and Category selectors at the bottom of the New/Edit event importer form. Again, there isn’t a way to trigger code that would allow the addition of such an element.

    Please tell me there is an easy solution or something I’ve overlooked to get this custom feature working properly again.

    #1212324
    Nico
    Member

    Hi Lisa,

    Thanks for getting in touch with us! Also thanks for taking the time to inspect the code before reaching out ๐Ÿ™‚

    I’ve checked what you report and it’s exactly as you say it is. I will log two different feature tickets here:

    • Make import statuses list filtrable: evaluate if it’s better to add a custom filter for this or use get_possible_stati instead of get_post_statuses.
    • Add an action to customize the import options: add a new action to insert custom options for an import, and make sure there are hooks available to save this information when the import runs.

    For now you can use this snippet (paste it into your theme’s (or child theme’s) functions.php file) to add custom post statuses to the dropdown. As far as I could check it’s working as expected:

    /* Tribe, add custom options to the import status dropdown */
    function tribe_extend_aggregtor_post_statuses(){

    $current_page = get_current_screen()->base;
    /* bail if not in the aggregator page */
    if($current_page != 'tribe_events_page_aggregator' ) return;

    ?>
    <script type="text/javascript">
    jQuery(document).ready ( function ($) {
    if ( $('#tribe-ea-field-post_status').length ) {
    $('#tribe-ea-field-post_status').append( $('<option>', { value: 'unread', text: 'Unread' }) );
    }
    });
    </script>
    <?php
    }
    add_action('admin_print_footer_scripts', 'tribe_extend_aggregtor_post_statuses');

    Please give it a try and let me know if it works for you,
    Best,
    Nico

    #1212336
    Lisa
    Participant

    That did work. Thanks!
    The ‘save_post_tribe_events’ hook did catch the added status allowing the custom code to work on those imported items.

    Thank you for logging the feature requests.

    #1212338
    Nico
    Member

    Woooot! Stocked to hear about this Lisa ๐Ÿ™‚

    You are welcome, I’ve linked this thread to the feature request to make import statuses list filtrable, so you’ll get a heads up here when it gets finally included in the plugin.

    For now Iโ€™ll go ahead and close out this thread, but if you need help with anything else please donโ€™t hesitate to create a new one and we will be happy to assist you.

    Thanks for confirming and once again thanks for the detailed description of the issue and for diving into the code before posting, it really helps us!
    Best,
    Nico

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Custom handling of imported items’ is closed to new replies.