• Resolved tautologe

    (@tautologe)


    Hello,

    I am using the Newsletter Plugin and want it to automatically display the next upcoming events in every new Email. So I used a query in the Newsletter Theme that already works in the same project. But in this case I get 3 “random” events, but not the upcoming.

    After hours of debugging in TEC and WordPress I found out, that the function TribeEventsQuery->setupQuery(), which seems to be responsible for translating all the event-related stuff in the query like “upcoming”=>”startdate > today”, is not executed in admin mode. This behavious seems to be intended, because it says “if ( !is_admin() && … ” at the beginning of the function.

    When I remove the !is_admin() condition, it works.

    So my 2 questions:
    1) Why?
    2) What can I do?

    Thanks!

    (I’m using TEC 2.0.8)

    My Query:

    get_posts(array(
                            'post_type' => TribeEvents::POSTTYPE,
                            'orderby' => 'event_date',
                            'order' => 'ASC',
                            "eventDisplay"=> "upcoming",
                            "numberposts" => 3
                        ));

    http://wordpress.org/extend/plugins/the-events-calendar/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi there tautologe. That is a great question and I want to make sure to get you a response here; while this is outside my particular area of expertise, I’ve asked one of the lead devs on this project to take a look and respond directly. Thanks for your patience and support so far.

    Thread Starter tautologe

    (@tautologe)

    Thanks, but after one week I’m still waiting for a response…

    Hey tautologe. Thanks for the follow-up; we generally only have bandwidth to hit this forum 1x a week, unfortunately. Users looking for daily forum responses are encouraged to buy a PRO license and move over to the forums at http://tri.be/support/forums, which are monitored by the team daily.

    I did speak with the devs on this today. You could technically create a function in your functions file that hooks into parse_query that is identical to the current function with the !is_admin() taken out. If you needed something more in the form of a tutorial I’ll see what can be done about getting that written up.

    Thread Starter tautologe

    (@tautologe)

    Hi thanks, that seems to work!

    But what I would like to know is, why did you disable event queries for admin views? Is there any undesirable side effect?

    Hey again tautologe. Good question; I checked with the devs on this, and in fact in the next major release (3.0, previously called 2.1) the queries will be able to be modified from the admin. My best guess as to why it WAS there was because of the hide_upcoming piece of it; we obviously don’t want posts marked as hide_upcoming NOT to show up in the admin. 😉

    Hope that helps. Let me know if you need more from there, and I’ll follow-up as needed. Cheers!

    I’m going to mark this one RESOLVED, as I haven’t heard back and my last response pretty much gave the answer needed here. If anyone disagrees let me know and I’ll follow-up again as needed.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘[Plugin: The Events Calendar] Using Event Queries in Admin Interface’ is closed to new replies.