Created
April 21, 2022 13:27
-
-
Save Pebblo/b189b8360761973f27db75a2868f6e05 to your computer and use it in GitHub Desktop.
Example of how to set EE events to have a default venue when created.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file | |
add_filter('FHEE__EE_Form_Input_Base___construct__input_args', 'tw_ee_set_default_event_venue', 10, 2); | |
function tw_ee_set_default_event_venue( $input_args, $input_obj) { | |
if( | |
!empty($input_args['html_name']) | |
&& $input_args['html_name'] === 'venue_id' | |
&& $input_obj instanceof EE_Select_Input | |
) { | |
// If no venue has been set on the event, set a default venue to use. | |
if( $input_args['default'] == 0 ) { | |
$input_args['default'] = '235'; | |
} | |
return $input_args; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment