Home › Forums › Calendar Products › Event Aggregator › Custom handling of imported items
- This topic has 4 replies, 3 voices, and was last updated 9 years, 3 months ago by
Lisa.
-
AuthorPosts
-
December 29, 2016 at 12:06 pm #1211497
Lisa
ParticipantTrying 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.
January 2, 2017 at 11:53 am #1212324Nico
MemberHi 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,
NicoJanuary 2, 2017 at 12:38 pm #1212336Lisa
ParticipantThat 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.
January 2, 2017 at 12:44 pm #1212338Nico
MemberWoooot! 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 -
AuthorPosts
- The topic ‘Custom handling of imported items’ is closed to new replies.
