widgets/list-widget.php not meeting no events condition

Home Forums Calendar Products Events Calendar PRO widgets/list-widget.php not meeting no events condition

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1215705
    Jeff Schneider
    Participant

    After 4.4 upgrade-
    I have a template override for widgets/list-widget.php.

    On my site’s front page, for a category with no events it is not showing any content at all, instead of the “There are no upcoming events at this time” message.

    I tested and removed the template override, but it still not showing any content for the category with no events.

    I added a test event for the category and the event shows fine,

    However removing the event does not get the “There are no upcoming events at this time” message.

    I tried putting other text within the else condition, but nothing.

    It seems to not hitting the else condition for
    if ( isset( $posts ) && $posts )

    Thank you

    #1216327
    Cliff
    Member

    Hi, Jeff. Thanks for your detailed question about /wp-content/plugins/events-calendar-pro/src/views/pro/widgets/list-widget.php

    It actually uses tribe_get_list_widget_events() from The Events Calendar core/free plugin, which ends up running this code: https://github.com/moderntribe/the-events-calendar/blob/4.4.0.1/src/Tribe/List_Widget.php#L106-L115

    Anyway, other than all that technical information, I wonder if it’s simply that you checked this box — https://cl.ly/0q1Y3e2C1f2Q ?

    #1216410
    Jeff Schneider
    Participant

    Cliff,

    Thank you for the reply.

    Apologies if I’m missing something, but this looks like a bug to me.

    On the list_widget.php, 4.4 introduced this on line 68

    $no_upcoming_events = true;

    Starting at line 114:

    // If no posts, and the don't show if no posts checked, let's bail
    if ( empty( self::$posts ) && $no_upcoming_events ) {
    	return;
    }

    So it doesn’t matter if the option is checked in the widget settings. If there are no posts it returns nothing.

    This explains to me why the “There are no upcoming events at this time” message post disappeared with 4.4.

    I verified this by commenting out line 68 in list_widget.php and the “There are no upcoming events at this time” message came back (of course I promptly uncommented)

    Thank you
    Jeff

    #1217144
    Cliff
    Member

    I did notice that code and it looked suspect to me too but couldn’t reproduce what you’re seeing.

    Please disable all non-Modern Tribe plugins and activate the Twenty Seventeen theme and then add PRO’s Event List widget to Twenty Seventeen’s Footer 1 widget area and click around your site to see if the issue is still happening for you. It’s not for me:

    Please let me know how this goes for you.

    #1217147
    Jeff Schneider
    Participant

    Thanks, though I’m not sure if we’re on the same page here. Your second screenshot shows events which is not relevant to my issue.

    What I’m reporting is that if there are no events, the widget should show the message “There are no upcoming events at this time”

    It doesn’t because the condition on line 114 will always evaluate as true if there are no events, regardless of what is checked in the widget settings.. and return nothing.

    It looks like someone else has reported the bug here

    I’ll try to get to your test request when I have a chance.

    #1217725
    Cliff
    Member

    Thanks for helping me get on the same page. I was able to reproduce the bug where the “There are no upcoming events at this time.” message doesn’t display in our latest release, and I reported it to our developers.

    I’ll mark this ticket as Pending Fix, which means this thread should receive a reply once the applicable fix has been released. I cannot guarantee when it will be fixed as it’s in the development team’s hands now. They need to assign it, code it, test it, and schedule it for release.

    I apologize for this issue and appreciate your understanding and patience.

    #1225969
    Christine White
    Participant

    Having the same issue after update from this week 4.4.1.1
    I too commented the line out for now and it works fine.
    On this install I am not using the Pro version.

    Kim

    #1226575
    Cliff
    Member

    Thanks for letting us know, Kim.

    As stated before, this thread should receive an update once the fix is released, hopefully sooner (weeks) than later (months).

    Have a good week.

    #1269217
    Brook
    Participant

    Howdy Jeff and Kim,

    Thank you both so much for taking the time to report a suspected bug!

    I just spent a good bit of time trying to reproduce your issues here, as did someone else from the team. Neither of us can reproduce this on the latest versions of our plugins. Is this now fixed for both of you as well?

    Jeff, you and the thread on WP.org mentioned the /wp-content/plugins/the-events-calendar/src/Tribe/List_Widget.php file, and you both were evidently looking for something that overrides $no_upcoming_events. After that variable is declared the extract() function can override this variable. The extract function will take any arguments passed from the widget or shortcode, such as the no upcoming events one, and override/declare any missing variables. At least, in theory it does this, and it is working great for me and my fellow tester. On both of our systems the “no upcoming events” message is displaying in a wide variety of scenarios. Hence why we are wondering if it is fixed for you now too.

    Please let us know if you have any questions. Cheers!

    – Brook

    #1269223
    Jeff Schneider
    Participant

    I just tested it out and when there are no events it shows the proper message, as expected. Thank you

    #1269348
    Cliff
    Member

    Jeff, thanks for the quick reply. I let Brook know as well. Have a great rest of your week!

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘widgets/list-widget.php not meeting no events condition’ is closed to new replies.