Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter("gform_pre_render_6", "populate_event_metaCreators");
- function populate_event_metaCreators($form){
- $postOptions = NULL;
- foreach($form['fields'] as &$field) {
- switch ($field['inputName']) {
- case 'OrganizerSelect':
- global $wpdb;
- $postOptions = $wpdb->get_results
- ("SELECT ID, post_title FROM $wpdb->posts where post_type = 'tribe_organizer' and post_status = 'publish' order by post_title ASC");
- break;
- case 'VenueSelect':
- global $wpdb;
- $postOptions = $wpdb->get_results
- ("SELECT ID, post_title FROM $wpdb->posts where post_type = 'tribe_venue' and post_status = 'publish' order by post_title ASC");
- break;
- }
- if($postOptions != NULL) {
- $choices = '';
- $choices[] = array('text' => '', 'value' => '', 'isSelected' => '', 'price' => '');
- $choices[] = array('text' => 'Add New Entry', 'value' => 'Add New Entry', 'isSelected' => '', 'price' => '');
- foreach ($postOptions as $postOption) {
- $choices[] = array('text' => $postOption->post_title, 'value' => $postOption->ID, 'isSelected' => '', 'price' => '');
- }
- $field['choices'] = $choices;
- $postOptions = NULL;
- }
- }
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement