Shortcode
Using the shortcode [eme_add_event_form] you can create a frontend submit form to add new events. The main settings and basic template can be set in the regular EME settings. This shortcode has 2 optional parameters:
- an optional id-parameter (pointing to the id of a template), so you can use different layouts if you want.
- the parameter “startdatetime=now”. If used, the startdate/time in the form will use the current date and time (and not be empty).
Example usage:
[eme_add_event_form]
[eme_add_event_form id=5]
[eme_add_event_form id=5 startdatetime=now]
Placeholders
The template can interpret shortcodes (EME and others) and the generic EME placeholders mentioned here.
Next to those placeholders, you have the following template-specific placeholders you can use:
- #_MAP ==> will show a graphical representation of a map (if you have other location-like parameters)
- #_FIELD{xxx} with xxx being one of:
- event_name
- event_status
- event_category_ids
- event_start_date
- event_start_time
- event_end_date
- event_end_time
- event_notes
- event_contactperson_email_body
- event_respondent_email_body
- event_url
- event_rsvp
- registration_requires_approval
- registration_wp_users_only
- event_image_url
- event_seats
- price
- location_name
- location_description
- location_address1
- location_address2
- location_city
- location_state
- location_zip
- location_country
For all possible fields, look at eme_events.php, function eme_new_event. And at eme_locations.php, function eme_new_location. The fields location_latitude and location_longitude will get added if/when needed as hidden fields.
- If you decide to use a captcha, use #_CAPTCHA (as in other forms). If you don’t specifiy the needed placeholder, EME will automatically add it at the end if needed.
- #_SUBMIT displays displays the submit button with the text you want for the button the text configured on the Settings page.
- #_SUBMIT{xx} displays displays the submit button with between the braces the text you want for the button (qtranslate compatible).
- For attributes, use #_ATT{xxx} with xxx being the name of the attribute you want to create
- Newer event settings are stored in event properties. For event properties, use #_PROP{xxx} with xxx being the name of the property you want to change. Some properties:
- auto_approve (*)
- ignore_pending (*)
- all_day (*)
- take_attendance (*)
- min_allowed
- max_allowed
- rsvp_end_target
- rsvp_discount
- rsvp_discountgroup
- use_worldpay (*)
- use_stripe (*)
- use_braintree (*)
- use_stripe (*)
See eme_events.php function eme_init_event_props(), for a whole list.
The ones marked with “*” are binary properies, use these like this: #_PROP{xx}{binary} - Custom event or location fields you created can also be rendered, by using #_CUSTOMFIELD{xxx} with xxx being the name of the custom field.
Field types
The placeholders #_FIELD, #_ATT and #_PROP (so not #_CUSTOMFIELD) accept an optional second parameter indicating the type of field you want rendered. The different types are: text (default), textarea, hidden, tel, url, email and number. The code tries to be sensible about which type should be used for several default fields, but this way you can specify it if/when needed.
An example: #_FIELD{xxx}{textarea}
Binary fields
Some fields need to be binary, for those you can use “binary” as specific field type, as example: #_PROP{all_day}{binary}
Required fields
If you want specific fields to be required in the form, use “#REQ_”: #REQ_FIELD{xx}, #REQ_ATT{xx}, etc ….
Default values and custom classes
If you want to specify a default value or custom class (or any html-attribute for that matter): the placeholders #_FIELD, #_ATT and #_PROP (so not #_CUSTOMFIELD) accept an optional third parameter. Example:
#_PROP{event_single_event_format_tpl}{hidden}{value=2}
Filters and actions
There are several hooks and filters:
eme_fs_submit_event_action
eme_ipn_fs_event_action
eme_fs_categories_filter
eme_fs_event_insert_filter
See the post on hooks and filters for explanation on these.