Home › Forums › Calendar Products › Community Events › Create Event with Date and Time
- This topic has 7 replies, 4 voices, and was last updated 9 years, 8 months ago by
Ryan.
-
AuthorPosts
-
July 26, 2016 at 8:37 am #1144234
Ryan
ParticipantHi,
We are trying to create a front end form which allows user to create an event. It’s pulling all the data fine and creating event too but for some reason the DATE and TIME field seems to be not working. We have tried doing it via field ID but it seems to be registering date “January 1 1970” and time is always “00:00” or it takes current day as a date and time will be always “8:00” to “5:00”
What we want to acheive here is to create a custom query args which pushes DATE and TIME too.
Below is the post object we’re pushing. We just need DATE and TIME selectors.
// Create post object
$event_data = array(
‘post_title’ => $event_title,
‘post_content’ => $event_description,
‘post_status’ => ‘pending’,
‘EventStartDate’ => $event_start_date,
‘EventEndDate’ => $event_end_date,
//’start_date’ => $event_start_date,
//’end_date’ => $event_end_date,
//’EventStartDate’ => $event_start_date,
//’EventEndDate’ => $event_end_date,
//’EventAllDay’ => ,
//’EventStartHour’ => ,
//’EventStartMinute’ => ,
//’EventEndHour’ => ,
//’EventEndMinute’ => ,
‘EventURL’ => $event_website,
//’EventCost’ => ,
‘Venue’ => array(
‘VenueID’ => $event_venue_existing_id,
‘Venue’ => $venue_name,
‘Address’ => $event_address,
‘City’ => $event_city,
‘Zip’ => $event_postcode,
),
‘Organizer’ => array(
‘OrganizerID’ => $event_organiser_existing_id,
‘Organizer’ => $event_organiser,
‘Website’ => $event_website,
//’Phone’ =>,
)
);Any help would be much appreciated.
Thanks,July 26, 2016 at 9:10 am #1144256Cliff
MemberHi Ryan.
If I’m understanding you correctly, you’re saying that you’re using the CE form but it’s not handling the times correctly, as you detailed.
Since this isn’t a known issue, I’d suggest following our recommended troubleshooting steps:
There might be some new updates available. Could you please make sure all your Modern Tribe plugins (and WordPress core) are at their latest versions?
Once you verify you’re on the latest versions, please test to see if the issue is still happening for you.
If it is, please follow our Testing for Conflicts Guide (basically switch to TwentySixteen theme and deactivate all plugins and custom code other than Modern Tribe plugins) and see if that helps narrow down the cause of this.
If it doesn’t, please enable WP_DEBUG and WP_DEBUG_LOG and share any PHP errors you see while changing tickets quantity, navigating your site’s home page, events page, single-event pages, and any other of your site’s pages relevant to this ticket.
Then, please share your System Information (while in Testing for Conflicts mode).
You might also see if you can spot any console errors at your site. (If needed, you may reference our KB article Using Google Chrome Developer Tools.)
Let us know what you find out.
Thanks.
July 26, 2016 at 11:37 am #1144329Ryan
ParticipantHi Cliff,
Thank you for your prompt reply. I have updated all Event manager plugin to latest version and also checked with theme conflict or plugin conflicts but there is no known conflict with any one of that.
All I need is wp_query so I can use tribe_create_event to add DATE and TIME from front end to feed into actual events. I have manage to feed all other data in but only DATE and TIME is not inserting from front-end.
Is there any selector or $args which can help me to add DATE and TIME from front-end form ?
July 26, 2016 at 3:32 pm #1144410Cliff
MemberPlease reference our Using tribe_get_events() and let me know if you have any follow-up questions.
July 27, 2016 at 1:20 am #1144512Ryan
ParticipantThis reply is private.
July 27, 2016 at 7:20 am #1144578Cliff
MemberSorry I didn’t fully understand.
It looks to me like you’re supplying a Start Date (e.g. “2016-07-27”) but not supplying anything for either 1) All Day or 2) Start Hour, Minute, Second, and Meridian (and same for End Date/Time arguments).
Here’s our documentation about tribe_create_event(). It’s basically a wrapper for wp_insert_post() with an extra argument to set the post_type appropriately and then runs your arguments through Tribe__Events__API::createEvent() — [the createEvent() method within the Tribe__Events__API class]
To be clear, Community Events does not use tribe_create_event(), but it does use Tribe__Events__API::createEvent() within this file: /wp-content/plugins/the-events-calendar-community-events/src/Tribe/Submission_Handler.php
Please let me know if you have any further questions.
August 18, 2016 at 9:35 am #1153161Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Create Event with Date and Time’ is closed to new replies.
