• 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

Viewing 15 replies - 1 through 15 (of 28 total)
  • Thread Starter mrwweb

    (@mrwweb)

    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

    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?

    Thread Starter mrwweb

    (@mrwweb)

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

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

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

    Thread Starter mrwweb

    (@mrwweb)

    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;
    }

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

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

    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?

    Thread Starter mrwweb

    (@mrwweb)

    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.

    mrwweb,

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

    Thread Starter mrwweb

    (@mrwweb)

    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.

    @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.

    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.

    Thread Starter mrwweb

    (@mrwweb)

    @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.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘"All Day Event" Bug in WP3.2 [with Solution]’ is closed to new replies.