WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
"All Day Event" Bug in WP3.2 [with Solution] (29 posts)

  1. mrwweb
    Member
    Posted 2 years ago #

    In WordPress 3.2, when making a new event, the "All Day Event" checkbox is checked, yet the time of day settings are displayed. Unchecking the "All Day Event" checkbox hides the time of day options. This makes it impossible to create a non-all-day event.

    I tracked down the issue to some incorrect jQuery. WordPress 3.2 ugrades from jQuery 1.4.4 to 1.6.1, and one of the major changes is how jQuery handles checkboxes.

    To fix the issue, make the following change.

    In /the-events-calendar/views/events-meta-box.php, lines 35-41 read:

    if( jQuery('#allDayCheckbox').attr('checked') == true ) {
      jQuery(".timeofdayoptions").addClass("tec_hide")
      jQuery("#EventTimeFormatDiv").addClass("tec_hide");
    }

    Change those lines to:

    if( jQuery('#allDayCheckbox').prop('checked', true) ) {
      jQuery(".timeofdayoptions").addClass("tec_hide");
      jQuery("#EventTimeFormatDiv").addClass("tec_hide");
    }

    This fixes uses the new .prop() method as well as adding a missing semicolon. Without this, I consider the plugin unusable, so it would be great if a new bug fixing release could come out with just this

  2. mrwweb
    Member
    Posted 2 years ago #

    Looking closer at the file, I see that the .prop() method should also be used on lines 47, 51, and 255.

    Respectively, changing those will
    * hide the form fields when the post isn't an event
    * hide eventbrite ticketing options when not being used
    * make sure that the event fields are validated when the post is an event

  3. JMJedi
    Member
    Posted 2 years ago #

    I've made this change, but the problem still persists. It doesn't seem like any changes I make in the events-meta-box.php file are being reflected on the actual Posts page. ANy idea what could be causing this?

  4. mrwweb
    Member
    Posted 2 years ago #

    Hmmmm. My testing wasn't as thorough as it should have been. Sorry for the premature post, I will continue working on this one...

  5. symetrikdesign
    Member
    Posted 2 years ago #

    I'm having this problem too. This plugin is basically unusable with this bug.

  6. symetrikdesign
    Member
    Posted 2 years ago #

    Mmrwweb, I suggest you remove the "resolved" from the title of the original post if you could.

  7. mrwweb
    Member
    Posted 2 years ago #

    Ok. Thanks for the feedback and sorry I got ahead of myself. I'd appreciate it if someone could test out these changes and let me know if it solves the issues for them as well. Please note that this is only for WordPress 3.2 and it assumes that you're loading [the default with 3.2] jQuery 1.6.1.

    All of these changes are in /wp-content/plugins/the-events-calendar/views/events-meta-box.php.

    -----------

    Line 18-21 are:

    if( jQuery('#allDayCheckbox').attr('checked') == true ) {
       jQuery(".timeofdayoptions").addClass("tec_hide")
       jQuery("#EventTimeFormatDiv").addClass("tec_hide");
    }

    Change them to:

    if( jQuery('#allDayCheckbox').prop('checked') ) {
       jQuery(".timeofdayoptions").addClass("tec_hide");
       jQuery("#EventTimeFormatDiv").addClass("tec_hide");
    }

    -----------

    Lines 23-29 are:

    jQuery("input[name='isEvent']").each(function(){
       if( jQuery(this).val() == 'no' && jQuery(this).attr('checked') == true ) {
          jQuery('#eventDetails, #eventBriteTicketing').hide();
       } else if( jQuery(this).val() == 'yes' && jQuery(this).attr('checked') == true ) {
          jQuery('#eventDetails, #eventBriteTicketing').show();
       }
    });

    Change them to:

    if( !jQuery("input[name='isEvent']").prop('checked') ) {
       jQuery('#eventDetails, #eventBriteTicketing').hide();
    } else {
       jQuery('#eventDetails, #eventBriteTicketing').show();
    }

    -----------

    Lines 126-128 are:

    if( jQuery("#isEventNo").attr('checked') == true ) {
       // do not validate since this is not an event
       return true;
    }

    Change them to:

    if( jQuery("input[name='isEvent']").val() == 'yes' ) {
       // do not validate since this is not an event
       return true;
    }
  8. JenniferWeltz
    Member
    Posted 2 years ago #

    This still doesn't fix it. The day tab is showing up 4 times

  9. JenniferWeltz
    Member
    Posted 2 years ago #

    I reversed changes you suggested for lines 23 to 29 and it fixed the duplicating day issues I was having.

  10. JenniferWeltz
    Member
    Posted 2 years ago #

    Seems to be working now. However I noticed that if the entry is not marked as an event is defaults to the date January 1 1970. At least for me - anyone else have that issue?

  11. mrwweb
    Member
    Posted 2 years ago #

    JenniferWeltz,

    When you say "defaults to the date January 1 1970" are you saying that it displays the date on the front end of the site and the post still acts like an event?

    I think the expected behavior of the plugin is that if you set it as "not an event" and save, any data saved to that event is lost. However, I'm not 100% sure of that.

  12. biscuitstudios
    Member
    Posted 2 years ago #

    mrwweb,

    plugin seems to be working great now with your fixes... wanted to send you a big thanks!

  13. mrwweb
    Member
    Posted 2 years ago #

    I'm glad it's working for you @biscuitstudios!

    @symetrikdesign and @JMJedi Let me know if the new round of changes worked on your site.

    @JenniferWeltz it occurs to me that you might check whether your theme or any plugins are unregistering jQuery 1.6.1 and registering an older version. If that's the case, all these changes are moot.

  14. symetrikdesign
    Member
    Posted 2 years ago #

    @mrwweb your second round of fixes with the corrected lines in 3 locations to /wp-content/plugins/the-events-calendar/views/events-meta-box.php is an improvement and makes this module useable.

    Some points:
    1) I tried copying /wp-content/plugins/the-events-calendar/views/events-meta-box.php to my theme's events directory in /wp-content/themes/twenteyeleven-clone/events/events-meta-box.php and made those changes and they had no effect.

    I tried this because in the documentation, that is the recommended place to make customizations.

    Making the changes to the plugin's file instead does work.

    2) I'm not sure that this is 100% fixed. It hide times if you have the "all day event" checked, and it does show times if you uncheck "all day event" but the validation is not working properly.

    I created an event that started on October 9th @ 10AM, and ended on July 6th at 8AM and the event with saved without an error. When I looked at the post, it showed a beginning date of October 9th @ 10AM and no end date.

    Thanks for the help and for now, I can at least use the module, but the validation is not 100% there.

    As a matter of fact, it doesn't seem like there is any validation on any of the other fields either - such as phone number format (was working before) and Price field (don't remember if that was working or not), and I can put events with no address, but checking the show google maps links checkboxes.

  15. symetrikdesign
    Member
    Posted 2 years ago #

    One more thing. Idea suggestion for module enhancement here:

    It would be a huge improvement, if the date selector automatically updated the TO date if these conditions are met.

    A) All day event is unchecked.

    B) When From date is selected, and time is selected, the To date is automatically set as the same date as the from date.

    So that when you go to select/set the TO date, you don't have to select and find the TO date. You may only need to change that if it is a multiple day event.

    Use case:
    You select From date and time of August 12th, 2011 @ 9AM
    Once, you select the from Date, the default date in the TO date field is automatically set as August 12th. So the only thing you need to pull down and select is the to time.

    If your event ends on August 13th, 2011 @ 5PM, you would obviously need to pull down and select both TO: date and time, but you only move your To date selector from August 12 to August 13th.

    Another thing that might be useful is if the "All day Event" checkbox is selected, the To Date field is hidden.

  16. mrwweb
    Member
    Posted 2 years ago #

    @symetrikdesign I think you're right that validation isn't quite working yet. If I get a chance, I'll continue looking at it.

    Just to be clear, though, I'm not an active contributor to this plugin and don't really have the time to be one. I fixed this out of necessity for a client and don't have the time to add new features. As far as I know, the plugin never really worked like that (although I too wish it did).

    Regarding the issue with the /events folder. TEC only allows that technique for the four template files that control how the information is displayed on the front end. For any other files it does not work. The basic idea -- I think -- was to support a technique similar to child theming for template files. To make this fix work, you have to make the actual fix in the plugin folder.

    If TEC doesn't fix this issue in a future release, we'll all have to go in and re-edit the files if we want to upgrade. #sadface.

  17. symetrikdesign
    Member
    Posted 2 years ago #

    @mrwweb, I appreciate your efforts and I was wondering if you were the plugin admin, or just a good samaritan.

    Thanks for your efforts and time contribution. You've gotten the module to a point where I too can finish a site for a client.

    I would think that this is serious enough that we should post this to the plugin developers bug tracking queue.

    I'll post my suggestions on validation separately so that they are not confused.

  18. JenniferWeltz
    Member
    Posted 2 years ago #

    @ mrwweb - if I choose "not an event" and enter any date it will still show January 1 1970 on the front end.

    However as long as I choose "event" it works fine. Since all my posts are events this really isn't an issue.

  19. smallwebsolutions
    Member
    Posted 2 years ago #

    Actually found the reason for this error and the fix for anyone still encountering this issue:

    http://wordpress.stackexchange.com/questions/22317/the-events-calendar-issues-in-wp-3-2

    Worked like a charm for me.

  20. Mrmark
    Member
    Posted 2 years ago #

    >Actually found the reason for this error and the fix for anyone still encountering this issue:
    >http://wordpress.stackexchange.com/questions/22317/the-events-calendar-issues-in-wp-3-2

    Didn't work for me. The date reproduced four times, as experienced by a poster on that page.

  21. Mrmark
    Member
    Posted 2 years ago #

    I wonder if the WP update that might be causing this problem also causes behavior where an edited event post forgets the date/time settings?

  22. Mrmark
    Member
    Posted 2 years ago #

    The above fix for 18-21, 23-29 and 126-128 only partially worked for me: the 126-128 block DIDN"T work, producing multiple entry days/times, while block 23-29 did work to both fix the checkbox and hide the events entry form until the radio button was checked.

  23. tcaywilson
    Member
    Posted 2 years ago #

    "The above fix for 18-21, 23-29 and 126-128 only partially worked for me: the 126-128 block DIDN"T work, producing multiple entry days/times, while block 23-29 did work to both fix the checkbox and hide the events entry form until the radio button was checked."

    I found this to work for me. If I updated the code at 126-128, I had duplicate dates (4) and it didn't work properly. This seems to resolve the problem.

    I did not have any luck with the fix at: http://wordpress.stackexchange.com/questions/22317/the-events-calendar-issues-in-wp-3-2, although I did not go back and see if just updating same code locations that worked for me with the other fix was successful.

    Much thanks to the other users who found the fix for this problem. It's a shame the plugin author is not supporting it.

  24. r3volution11
    Member
    Posted 2 years ago #

  25. brackishwaters
    Member
    Posted 2 years ago #

    First - r3volution11, Thank you for the fix there as it was a solid solution.
    Some notes:

    • You must make sure that you are using the 1.6.2 version of jquery when using this fix or else it will not work
    • The checked/unchecked issue with all day events still shows up. One hack for this is go to line 969 of the-events-calendar.class.php and change the 'checked' to 'unchecked'.
    • If you still see the 4 day input bug, make sure you are using jquery version 1.6.2.

    Hope that helps.

  26. r3volution11
    Member
    Posted 2 years ago #

    Hey guys. I was running into the same issue again with one of my installs so I dove into the jQuery again in events-meta-options.php and changed a couple of things around. It's 100% working for me now on all installs (4 sites) so hopefully it will be the same for you all.

    Hit up rvo.me/dia for the code and please comment if it does or doesn't do the job. :)

  27. r3volution11
    Member
    Posted 2 years ago #

    By the way, I'm slowly going through and updating everything actually. I've currently got a lot of projects on my plate so it will take me a few but hopefully soon I'll have something together that will work out of box with the Roots theme (http://www.rootstheme.com/).

  28. bleggate
    Member
    Posted 2 years ago #

    Thank you.
    Worked a treat for me although I now have another issue which i do not think is related but might be.

    my theme layout has suddenly broken by pulling the sidebars incorrectly.
    sidebar content sidebar layout is okay as is full content is okay but when layout of sidebar- content or content-sidebar is called the sidebars are pulled when they are not meant to be.

    My default layout is sidebar-content-sidebar

    sidebar-content
    The sidebar primary is called followed by the content followed by the sidebar-alt

    content-sidebar
    the content is called then the sidebar then the sidbar-alt under the comments feild.

    Very odd

    You can view here.

    http://margaretriverguide.com.au/eguide

    and here

    http://margaretriverguide.com.au/resources/testing/

    I would appreciate your assistance and some pointers as I can not find the cause of this issue.

    Recent actions include upgrades to wordpress 3.2.1 and genesis.
    Instal of flash video player plugin (uninstalled to see if fixed problem but with no difference) and this change to The Events Calendar.

    If I deactivate the events calendar the theme is all okay again, so may or may not be related to this change, although I have it working on another similar site? r3volution11 I would appreciate you looking as you have a sound knowledge of this plugin or anyone else who has a good idea to try.

    Thanks

  29. bwp
    Member
    Posted 2 years ago #

    r3volution11, I tried comparing your new code to the original, and the DOS fc command gave up, saying they were too different. I noticed you even removed stuff like some of the EventBrite language. Probably not a big deal, but it just makes me wary until I can audit everything....

    Still I want and need a solution like yours, and I thank you for sharing it...

    Meanwhile, the save-draft workaround has been doing the job.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic