Home › Forums › Calendar Products › Events Calendar PRO › Show list of organizers who have events only
- This topic has 5 replies, 2 voices, and was last updated 7 years, 9 months ago by
tokkilee.
-
AuthorPosts
-
June 19, 2018 at 4:18 pm #1556668
tokkilee
ParticipantI’m creating an extra filter for my website that allows a user to choose events based on organizer via a select dropdown. However, I’d like to only show organizers in the dropdown that have actual events tied to them. (You can see the dropdown here http://nashvillesocialproject.com/events/) I’m using get_posts to generate this.
I’ve looked through the code in the plugin to see where the single-organizers code is outputted (example http://nashvillesocialproject.com/organizer/poor-peoples-campaign/), to see if I could just grab the loop info since that obviously has the events filtered by organizer already, but couldn’t find where it was referenced. I’m assuming you’re using a database query to select posts that are tied to both post types, am I correct? Would it be possible to share that bit of code so I could tie it into my dropdown?
June 20, 2018 at 9:54 am #1557362tokkilee
ParticipantSo I’ve found the function tribe_get_organizers(), but using it with ‘only_with_upcoming’ => true only returns *2* organizers (posts_per_page is set to -1) but I have more organizers than that. setting it to ‘has_events’ => true brings back 26 organizers, but shows organizers with events that have passed. Here’s an example of the function:
$args = array( 'only_with_upcoming' => true ); $organizers = tribe_get_organizers( '', $posts_per_page = -1, $suppress_filters = false, $args); foreach ($organizers as $org) { echo $org->post_title; }What am I doing wrong here?
June 20, 2018 at 1:42 pm #1557608tokkilee
ParticipantSO I’ve narrowed it down to the fact there’s a bug with the actual Events Calendar plugin. The default posts_per_page in tribe_get_events is affecting the calculation of the organizer list in find_with_upcoming_events() – the call to $events = tribe_get_events( $args ); returns only max 10 events, which isn’t enough to calculate the full number of organizers. Adding posts_per_page => -1 into the $args array on line 277 of Base.php seems to be a suitable fix for this.
Is it possible this will be fixed in the future? I hate editing core plugin files since it’ll get overwritten when upgrading.
June 20, 2018 at 3:17 pm #1557679Jennifer
KeymasterHello,
Thanks for reaching out! Just to set expectations, I do need to point out that customizations are outside the scope of support that we are able to provide here in the forums. However, I’ll be happy to see if I can point you in the right direction here!
I did some testing with this function on my end and was not getting the results I was expecting, so I reached out to one of our developers to see if he can provide some further insight. I’ll let you know as soon as I hear back.
June 20, 2018 at 3:44 pm #1557693tokkilee
ParticipantRight I understand, but this is a standard function that’s already in the plugin that has the bug.
June 21, 2018 at 4:24 pm #1558783Jennifer
KeymasterDefinitely, if this is indeed not working correctly, then I will log it in the system as a bug. I just want to have a developer take a look first to see if there is something that we’re missing. If there is, we should be able to get a quick solution from him 🙂 I haven’t heard back yet, but as soon as I do, I will let you know.
July 13, 2018 at 9:35 am #1574859Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Show list of organizers who have events only’ is closed to new replies.
