Private Events in iCal Feed

Home Forums Calendar Products Events Calendar PRO Private Events in iCal Feed

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1426390
    Felix Hirschfeld
    Participant

    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,
    Felix

    #1427393
    Andras
    Keymaster

    Hi 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,
    Andras

    #1427407
    Andras
    Keymaster

    Hallo 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,
    Andras

    #1427452
    Felix Hirschfeld
    Participant

    Hi 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?

    #1428291
    Andras
    Keymaster

    Hallo 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

    #1429220
    Felix Hirschfeld
    Participant

    Wow you’re awesome dude! That works!

    #1429223
    Andras
    Keymaster

    Whoa, 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,
    Andras

    PS: 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!

     

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Private Events in iCal Feed’ is closed to new replies.