Home › Forums › Ticket Products › Community Tickets › Default start/end times for community events
- This topic has 7 replies, 2 voices, and was last updated 6 years, 8 months ago by anywherefest.
-
AuthorPosts
-
July 6, 2017 at 9:43 pm #1317259anywherefestParticipant
I am using the snippet provided by Nico to change the start/end times for community events but it isn’t working- can you help?
add_action( ‘tribe_community_events_form_start_time_selector’, ‘comm_default_start_time’, 10, 2 );
function comm_default_start_time( $output, $event_id ) {if ( !$event_id ) {
$new_time = strtotime( ‘7:30pm’ );
$start_date = tribe_event_format_date( $new_time, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT );
$start_minutes = Tribe__Events__View_Helpers::getMinuteOptions( $start_date, true );
$start_hours = Tribe__Events__View_Helpers::getHourOptions( $is_all_day == ‘yes’ ? null : $start_date, true );
$start_meridian = Tribe__Events__View_Helpers::getMeridianOptions( $start_date, true );$output = ”;
$output .= sprintf( ‘<select name=”EventStartHour”>%s</select>’, $start_hours );
$output .= sprintf( ‘<select name=”EventStartMinute”>%s</select>’, $start_minutes );
if ( ! tribe_community_events_use_24hr_format() ) {
$output .= sprintf( ‘<select name=”EventStartMeridian”>%s</select>’, $start_meridian );
}
}return $output;
}add_action( ‘tribe_community_events_form_end_time_selector’, ‘comm_default_end_time’, 10, 2 );
function comm_default_end_time( $output, $event_id ) {if ( !$event_id ) {
$new_time = strtotime( ‘8:30pm’ );
$start_date = tribe_event_format_date( $new_time, true, Tribe__Events__Date_Utils::DBDATETIMEFORMAT );
$start_minutes = Tribe__Events__View_Helpers::getMinuteOptions( $start_date, true );
$start_hours = Tribe__Events__View_Helpers::getHourOptions( $is_all_day == ‘yes’ ? null : $start_date, true );
$start_meridian = Tribe__Events__View_Helpers::getMeridianOptions( $start_date, true );$output = ”;
$output .= sprintf( ‘<select name=”EventStartHour”>%s</select>’, $start_hours );
$output .= sprintf( ‘<select name=”EventStartMinute”>%s</select>’, $start_minutes );
if ( ! tribe_community_events_use_24hr_format() ) {
$output .= sprintf( ‘<select name=”EventStartMeridian”>%s</select>’, $start_meridian );
}
}return $output;
}July 7, 2017 at 7:54 pm #1317752PatriciaMemberHey Alex,
Thanks for contacting us.
This snippet you are trying to implement was written in 2015 and our code base has changed since then. We will review this snippet and get back to you as soon as we have further information!
Let us know if you need anything else in the mean time and have a great weekend!
Regards,
Patricia
July 7, 2017 at 9:47 pm #1317777anywherefestParticipantThanks Patricia- I look forward to hearing from you.
July 10, 2017 at 7:54 am #1318394PatriciaMemberHey Alex,
Please add this snippet to your functions.php file:
https://gist.github.com/nefeline/aceabe1f914a0583340396d25c0b2308
This code will update the default time for both The Events Calendar and Community Events.
Let me know if this works for you or if you need anything else and I’ll be happy to assist!
Regards,
Patricia
July 10, 2017 at 3:59 pm #1319181anywherefestParticipantIt works perfectly Patricia- thank you!
July 10, 2017 at 5:00 pm #1319217PatriciaMemberHi Alex,
Good to know that it worked as expected!
Let me know if you need anything else and have a great week! 🙂
Regards,
Patricia
August 1, 2017 at 9:35 am #1328874Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Default start/end times for community events’ is closed to new replies.