Home › Forums › Calendar Products › Events Calendar PRO › Private Events in iCal Feed
- This topic has 7 replies, 2 voices, and was last updated 6 years, 3 months ago by Felix Hirschfeld.
-
AuthorPosts
-
January 15, 2018 at 4:12 am #1426390Felix HirschfeldParticipant
Hey there 🙂
My client uses TEC for events and internal planning, it’s a club. So they set internal events as private (so they are not accessible for visitors), but I need to include them in the iCal feed… is this possible?
peace,
FelixJanuary 16, 2018 at 3:19 am #1427393AndrasKeymasterHi Felix,
Thanks for using our plugins and welcome to the forums!
That is not possible out of the box. I will need to check around a bit if that could be done with a snippet or something. Please give me a day or 2 and I’ll get back to you. Thanks for hanging in there.
Cheers,
AndrasJanuary 16, 2018 at 3:50 am #1427407AndrasKeymasterHallo Felix,
There is a very hacky was of doing this. You will need to make a small change in one of the core files, which also means that the modification will be lost when you update the plugin.
Here is what you need to do:
Open this file for editing:
wp-content\plugins\the-events-calendar\src\Tribe\iCal.php
Line 255 looks like this:
$query = new WP_Query( array_merge( $wp_query->query, array( 'posts_per_page' => $count ) ) );
Replace it with this:
$query = new WP_Query( array_merge( $wp_query->query, array( 'posts_per_page' => $count, 'post_status' => array( 'publish', 'private' ) ) ) );
Check if that does the trick.
Cheers,
AndrasJanuary 16, 2018 at 5:53 am #1427452Felix HirschfeldParticipantHi András,
thank you very much. But I won’t use this cause it’s not update save. We have a category “private” and I redirect these events in the frontend so no one can access them.
Is there a way to exclude a category from the feed?
January 17, 2018 at 1:15 am #1428291AndrasKeymasterHallo Felix,
I was digging around a bit and there might be a way to make it “stable”.
In this article I found this snippet:
add_action( 'pre_get_posts', 'custom_teardown_tribe_order_filter', 60 );
function custom_teardown_tribe_order_filter() {
if ( is_feed() ) remove_filter( 'posts_orderby', array( 'Tribe__Events__Query', 'posts_orderby' ), 10, 2 );
}Obviously the above does something totally different, but based on that you can try this:
add_action( 'pre_get_posts', 'add_private_events_to_rss', 60 );
function add_private_events_to_rss() {
if ( is_feed() ) add_filter( 'post_status', array( 'publish', 'private' ), 10, 2 );
}I haven’t tested this but logically makes sense. 🙂
Would this help?
Andras
January 18, 2018 at 1:58 am #1429220Felix HirschfeldParticipantWow you’re awesome dude! That works!
January 18, 2018 at 2:10 am #1429223AndrasKeymasterWhoa, stoked to hear that actually worked. 🙂 Awesome to hear.
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please create a new ticket and we’ll be happy to help.
Cheers dude,
AndrasPS: If you like our plugins, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
https://wordpress.org/support/view/plugin-reviews/the-events-calendar/
https://wordpress.org/support/view/plugin-reviews/event-tickets/PS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!
-
AuthorPosts
- The topic ‘Private Events in iCal Feed’ is closed to new replies.