Start Time Changes When Error Message is Returned

Home Forums Calendar Products Community Events Start Time Changes When Error Message is Returned

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1039617
    Sean
    Participant

    Unfortunately, this issue was not fixed in 4.0.1. Please advise. Thank you.

    #1039938
    Barry
    Member

    Hi Karly,

    So you’ve got two functions in your snippet – comm_default_end_time() and comm_default_end_time() – and right now they run every time the Community Events editor form is displayed.

    In this case, we really only need them to run the first time the editor displays: if the form has already been submitted, you don’t need or want to interfere with those time selectors.

    To that end, try adding the following piece of code at the top of each function:

    // Don't interfere if the form has been submitted
    if ( ! empty( $_POST ) ) {
    	return $output;
    }

    For example, the start of your comm_default_start_time() function should look something like this:

    function comm_default_start_time( $output, $event_id ) {
    	// Don't interfere if the form has been submitted
    	if ( ! empty( $_POST ) ) {
    		return $output;
    	}
    
    	if ( ! $event_id ) {
    	/* ... rest of the function  ... */ 
    

    Hopefully that fixes things for you 🙂

    #1039945
    Sean
    Participant

    Hi Barry,

    Thank you for this suggestion and the detailed instructions. I gave it a try, but unfortunately the times are still being changed when an error message is returned. Now, the end time that is entered is being set as the start time, and the end time is being set as 5pm. For example, if I enter 5:00am for the start time and 11:00am for the end time, the times displayed when the page is reloaded are 11:00am – 5:00pm. A second example would be 6:15pm – 7:30pm being changed to 7:30pm – 5:00pm.

    Any other thoughts on how we might be able to get this fixed? Thanks again and have a wonderful weekend!

    #1039959
    Barry
    Member

    I’m not sure why you’re experiencing that – did you update both functions and can you share your current code for this modification?

    (A Gist or Pastebin URL is best – thanks!)

    #1039963
    Sean
    Participant

    I did update both functions, so I’m stumped as to what is causing the issue now. Here’s the current code, including the two revised functions with your earlier suggestion: http://pastebin.com/QvvZv0z9

    #1040525
    Barry
    Member

    Ah yes, some of the code in those custom functions was a slightly mixed up. Here’s a freshened up version:

    https://gist.github.com/anonymous/d30e20ecd9e17f61843d

    I hope that helps! I do want to note though that, generally speaking, custom dev tasks like this are something you need to drive forward – and maintain – under your own steam.

    I didn’t want to leave you high and dry here since see you’ve been persevering with this for a while and through a number of support exchanges – however as a rule of thumb the code we offer up here in the forums should be regarded as a starting point that you can take and tweak by yourself.

    In any case, I do hope that gets you closer 🙂

    #1040546
    Sean
    Participant

    Hi Barry,

    Thanks for taking the time to look that code over and for providing a corrected version; it works great! And totally understand that your team doesn’t typically offer complete solutions for customization’s – that’s be a lot of work for what we pay for the plugins.

    Just a thought…perhaps another revenue funnel could be offering a “premium” level of support. In exchange for an annual membership, the user would have access to any snippets your team had created thus far. For an additional fee, a user could submit a request for a new snippet to be created (which would be added to the snippet library, available to only current premium members). Since the snippets would likely change as new versions of the plugin are released, there would be incentive for users to renew their “premium” membership to ensure they can continue using the customization’s as they update to the newest version of the plugins. I’m sure some outsource for customization’s, but it could be something of interest for the non-technical users that want to tweak TEC a bit more but don’t want to be bothered hiring a 3rd party to do the work (who would likely need to charge more to account for the time it’d take them to get acquainted with TEC codebase). Anyways, that’s my idea of the day. Feel free to share with the team or discard!

    Best,
    Karly

    #1040613
    Barry
    Member

    Glad the fix worked and I’ll certainly share that idea with the team for further discussion.

    Thanks again and if anything else crops up please do feel free to create a new topic 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Start Time Changes When Error Message is Returned’ is closed to new replies.