Support » Plugin: Events Made Easy Frontend Submit » Locations Drop-Down Menu

  • Resolved mattsenate

    (@mattsenate)


    Howdy,

    Trying to implement this front-end form plugin with use of EME as an event-request form. For my end-users, I would like them to choose from a pre-defined list of plugins. EME has an option for requiring “drop-down” location selection in the admin interface, rather than allowing location creation from the Edit Event screen. It would be great if EMEFS could support this same option from EME to require front-end users to select locations from a drop-down menu, rather than the search interface.

    Otherwise, I thought it might be possible to create an alternative form template that successfully posts locations from a drop-down selection. Below is what I’ve written so far, but the location is not successfully being saved to the database… any help, suggestions, etc appreciated!

    <div id="new_event_form">
    
    	<form id="new_post" name="new_post" method="post" action="<?php the_permalink(); ?>">
    
    		<h2><?php _e('Event Information','emefs'); ?></h2>
    
    		<div class="input">
    			<label for="title"><?php _e('Event Name','emefs'); ?> <small><?php _e('required','emefs'); ?></small></label><br />
    			<?php EMEFS::field('event_name'); ?>
    			<?php EMEFS::error('event_name'); ?>
    		</div>
    
    		<?php
    		if (get_option('eme_categories_enabled')) { ?>
    		<div class="input select">
    			<label for="event_category_ids"><?php _e('Select the Event Category','emefs'); ?> <small><?php _e('required','emefs'); ?></small></label><br/>
    			<?php EMEFS::field('event_category_ids'); ?>
    			<?php EMEFS::error('event_category_ids'); ?>
    		</div>
    		<?php } ?>
    
    		<fieldset>
    
    			<legend><?php _e('Date & Time','emefs'); ?></legend>
    
    			<fieldset id="event_start">
    				<legend><?php _e('Start','emefs'); ?> <small><?php _e('required','emefs'); ?></small></legend>
    				<div class="input">
    					<label for="event_start_date"><?php _e('Date','emefs'); ?></label>
    					<?php EMEFS::field('event_start_date'); ?>
    					<?php EMEFS::error('event_start_date'); ?>
    				</div>
    				<div class="input">
    					<label for="event_start_time"><?php _e('Time','emefs'); ?></label>
    					<?php EMEFS::field('event_start_time'); ?>
    					<?php EMEFS::error('event_start_time'); ?>
    				</div>
    			</fieldset>
    
    			<fieldset id="event_end">
    				<legend><?php _e('End','emefs'); ?></legend>
    				<div class="input">
    					<label for="event_end_date"><?php _e('Date','emefs'); ?></label>
    					<?php EMEFS::field('event_end_date'); ?>
    					<?php EMEFS::error('event_end_date'); ?>
    				</div>
    				<div class="input">
    					<label for="event_end_time"><?php _e('Time','emefs'); ?></label>
    					<?php EMEFS::field('event_end_time'); ?>
    					<?php EMEFS::error('event_end_time'); ?>
    				</div>
    			</fieldset>
    
    			<?php EMEFS::error('event_time'); ?>
    
    		</fieldset>
    
    		<div class="input">
    			<label for="event_description"><?php _e('Description','emefs'); ?> <small><?php _e('required','emefs'); ?></small></label><br />
    			<?php EMEFS::field('event_notes'); ?>
    			<?php EMEFS::error('event_notes'); ?>
    		</div>
    
    		<div class="input">
    			<label for="event_contactperson_email_body"><?php _e('Contact E-mail','emefs'); ?></label><br />
    			<?php EMEFS::field('event_contactperson_email_body'); ?>
    			<?php EMEFS::error('event_contactperson_email_body'); ?>
    		</div>
    
    		<div class="input">
    			<label for="event_url"><?php _e('Event Web Page','emefs'); ?></label><br />
    			<?php EMEFS::field('event_url'); ?>
    			<?php EMEFS::error('event_url'); ?>
    		</div>
    
    		<h3><?php _e('Location Information','emefs'); ?></h3>
    
    		<?php
    		$location_0 = eme_new_location();
    		$location_0['location_id']=0;
    		$locations = eme_get_locations();
    		?>
    
    		<div class="input">
    			<label for="location_id"><?php _e('Location','events-made-easy') ?></label><br />
    			<select name="location-select-id" id='location-select-id' size="1">
    				<option value="<?php echo $location_0['location_id'] ?>" ><?php echo eme_trans_sanitize_html($location_0['location_name']) ?></option>
    			<?php
    			$selected_location=$location_0;
    			foreach($locations as $tmp_location) {
    				$selected = "";
    				if (isset($location['location_id']) && $location['location_id'] == $tmp_location['location_id']) {
    					$selected_location=$location;
    					$selected = "selected='selected' ";
    				}?>
    				<option value="<?php echo $tmp_location['location_id'] ?>" <?php echo $selected ?>><?php echo eme_trans_sanitize_html($tmp_location['location_name']) ?></option><?php
    			}?>
    			</select>
    
    			<input type='hidden' name='location-select-name' value='<?php echo eme_trans_sanitize_html($selected_location['location_name'])?>' />
    			<input type='hidden' name='location-select-town' value='<?php echo eme_trans_sanitize_html($selected_location['location_town'])?>' />
    			<input type='hidden' name='location-select-address' value='<?php echo eme_trans_sanitize_html($selected_location['location_address'])?>' />
    			<input type='hidden' name='location-select-latitude' value='<?php echo eme_trans_sanitize_html($selected_location['location_latitude'])?>' />
    			<input type='hidden' name='location-select-longitude' value='<?php echo eme_trans_sanitize_html($selected_location['location_longitude'])?>' />
    
    		</div>
    
    		<p class="submit">
    			<?php EMEFS::end_form(__('Submit Event','emefs')); ?>
    		</p>
    
    	</form>
    
    </div>

    https://wordpress.org/plugins/events-made-easy-frontend-submit/

Viewing 1 replies (of 1 total)
  • Plugin Author Franky

    (@liedekef)

    Currently dropdown doesn’t save the info because of this line:

    $event_data = self::processLocation($event_data, $force);

    The function processLocation doesn’t take the location id into account.
    So either change that function, or – more quickly – change:

    $event_data = self::processLocation($event_data, $force);

    by

    $event_data['location_id'] = (int) $_POST['location-select-id'];

Viewing 1 replies (of 1 total)
  • The topic ‘Locations Drop-Down Menu’ is closed to new replies.