$postValue){ if( substr($postKey, 0, 5) == 'dbem_' ){ //TODO some more validation/reporting $numeric_options = array('dbem_locations_default_limit','dbem_events_default_limit'); if( in_array($postKey,$numeric_options) && !is_numeric($postValue) ){ //Do nothing, keep old setting. }else{ //TODO slashes being added? update_option($postKey, stripslashes($postValue)); } } } //set capabilities if( !empty($_POST['em_capabilities']) && is_array($_POST['em_capabilities']) && (!is_multisite() || is_multisite() && is_super_admin()) ){ global $em_capabilities_array, $wp_roles; foreach( $wp_roles->role_objects as $role_name => $role ){ foreach( array_keys($em_capabilities_array) as $capability){ if( !empty($_POST['em_capabilities'][$role_name][$capability]) ){ $role->add_cap($capability); }else{ $role->remove_cap($capability); } } } } update_option('dbem_flush_needed',1); do_action('em_options_save'); $EM_Notices->add_confirm(''.__('Changes saved.', 'dbem').'', true); wp_redirect(wp_get_referer()); exit(); } //Migration if( !empty($_GET['em_migrate_images']) && check_admin_referer('em_migrate_images','_wpnonce') && get_option('dbem_migrate_images') ){ include(plugin_dir_path(__FILE__).'../em-install.php'); $result = em_migrate_uploads(); if($result){ $failed = ( $result['fail'] > 0 ) ? $result['fail'] . ' images failed to migrate.' : ''; $EM_Notices->add_confirm(''.$result['success'].' images migrated successfully. '.$failed.''); } wp_redirect(admin_url().'edit.php?post_type=event&page=events-manager-options&em_migrate_images'); }elseif( !empty($_GET['em_not_migrate_images']) && check_admin_referer('em_not_migrate_images','_wpnonce') ){ delete_option('dbem_migrate_images_nag'); delete_option('dbem_migrate_images'); } //Uninstall if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall' && !empty($_REQUEST['confirmed']) && check_admin_referer('em_uninstall_'.get_current_user_id().'_wpnonce') && is_super_admin() ){ if( check_admin_referer('em_uninstall_'.get_current_user_id().'_confirmed','_wpnonce2') ){ //We have a go to uninstall global $wpdb; //delete EM posts remove_action('before_delete_post',array('EM_Location_Post_Admin','before_delete_post'),10,1); remove_action('before_delete_post',array('EM_Event_Post_Admin','before_delete_post'),10,1); remove_action('before_delete_post',array('EM_Event_Recurring_Post_Admin','before_delete_post'),10,1); $post_ids = $wpdb->get_col('SELECT ID FROM '.$wpdb->posts." WHERE post_type IN ('".EM_POST_TYPE_EVENT."','".EM_POST_TYPE_LOCATION."','event-recurring')"); foreach($post_ids as $post_id){ wp_delete_post($post_id); } //delete categories $cat_terms = get_terms(EM_TAXONOMY_CATEGORY, array('hide_empty'=>false)); foreach($cat_terms as $cat_term){ wp_delete_term($cat_term->term_id, EM_TAXONOMY_CATEGORY); } $tag_terms = get_terms(EM_TAXONOMY_TAG, array('hide_empty'=>false)); foreach($tag_terms as $tag_term){ wp_delete_term($tag_term->term_id, EM_TAXONOMY_TAG); } //delete EM tables $wpdb->query('DROP TABLE '.EM_EVENTS_TABLE); $wpdb->query('DROP TABLE '.EM_BOOKINGS_TABLE); $wpdb->query('DROP TABLE '.EM_LOCATIONS_TABLE); $wpdb->query('DROP TABLE '.EM_TICKETS_TABLE); $wpdb->query('DROP TABLE '.EM_TICKETS_BOOKINGS_TABLE); $wpdb->query('DROP TABLE '.EM_RECURRENCE_TABLE); $wpdb->query('DROP TABLE '.EM_CATEGORIES_TABLE); $wpdb->query('DROP TABLE '.EM_META_TABLE); //delete options $wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\''); //deactivate and go! deactivate_plugins(array('events-manager/events-manager.php','events-manager-pro/events-manager-pro.php'), true); wp_redirect(admin_url('plugins.php?deactivate=true')); exit(); } } //Reset if( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset' && !empty($_REQUEST['confirmed']) && check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && is_super_admin() ){ if( check_admin_referer('em_reset_'.get_current_user_id().'_confirmed','_wpnonce2') ){ //We have a go to uninstall global $wpdb; //delete options $wpdb->query('DELETE FROM '.$wpdb->options.' WHERE option_name LIKE \'em_%\' OR option_name LIKE \'dbem_%\''); //reset capabilities global $em_capabilities_array, $wp_roles; foreach( $wp_roles->role_objects as $role_name => $role ){ foreach( array_keys($em_capabilities_array) as $capability){ $role->remove_cap($capability); } } //go back to plugin options page $EM_Notices->add_confirm(__('Settings have been reset back to default. Your events, locations and categories have not been modified.','dbem'), true); wp_redirect(EM_ADMIN_URL.'&page=events-manager-options'); exit(); } } } add_action('admin_init', 'em_options_save'); function em_admin_options_reset_page(){ if( check_admin_referer('em_reset_'.get_current_user_id().'_wpnonce') && is_super_admin() ){ ?>


go to your plugins page.','dbem'), wp_nonce_url(admin_url('plugins.php'))); ?>

'. __('Event Related Placeholders','dbem') .''; $locations_placeholders = ''. __('Location Related Placeholders','dbem') .''; $bookings_placeholders = ''. __('Booking Related Placeholders','dbem') .''; $categories_placeholders = ''. __('Category Related Placeholders','dbem') .''; $events_placeholder_tip = " ". sprintf(__('This accepts %s and %s placeholders.','dbem'),$events_placeholders, $locations_placeholders); $locations_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $locations_placeholders); $categories_placeholder_tip = " ". sprintf(__('This accepts %s placeholders.','dbem'), $categories_placeholders); $bookings_placeholder_tip = " ". sprintf(__('This accepts %s, %s and %s placeholders.','dbem'), $bookings_placeholders, $events_placeholders, $locations_placeholders); global $save_button; $save_button = ' 

'; ?>


id] = $EM_Category->name; } em_options_select ( __( 'Default Category', 'dbem' ), 'dbem_default_category', $category_options, __( 'This option allows you to select the default category when adding an event.','dbem' ).' '.__('If an event does not have a category assigned when editing, this one will be assigned automatically.','dbem')); } } em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'dbem' ),__('event','dbem')), 'dbem_attributes_enabled', __( 'Select yes to enable the attributes feature','dbem' ) ); em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'dbem' ),__('event','dbem')), 'dbem_cp_events_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','dbem' ) ); if( get_option('dbem_attributes_enabled') ){ em_options_textarea ( sprintf(__( '%s Attributes', 'dbem' ),__('Event','dbem')), 'dbem_placeholders_custom', sprintf(__( "You can also add event attributes here, one per line in this format #_ATT{key}. They will not appear on event pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. More information on placeholders.", 'dbem' ), EM_ADMIN_URL .'&page=events-manager-help') ); } if( get_option('dbem_locations_enabled') ){ /*default location*/ $location_options = array(); $location_options[0] = __('no default location','dbem'); $EM_Locations = EM_Locations::get(); foreach($EM_Locations as $EM_Location){ $location_options[$EM_Location->location_id] = $EM_Location->location_name; } em_options_select ( __( 'Default Location', 'dbem' ), 'dbem_default_location', $location_options, __( 'This option allows you to select the default location when adding an event.','dbem' )." ".__('(not applicable with event ownership on presently, coming soon!)','dbem') ); /*default location country*/ em_options_select ( __( 'Default Location Country', 'dbem' ), 'dbem_location_default_country', em_get_countries(__('no default country', 'dbem')), __('If you select a default country, that will be pre-selected when creating a new location.','dbem') ); } ?> {no_location}...{/no_location} or {has_location}..{/has_location} conditional placeholder to selectively display location information.','dbem' ) ); em_options_radio_binary ( __( 'Use dropdown for locations?', 'dbem' ), 'dbem_use_select_for_locations', __( 'Select yes to select location from a drow-down menu; location selection will be faster, but you will lose the ability to insert locations with events','dbem' ) ); em_options_radio_binary ( sprintf(__( 'Enable %s attributes?', 'dbem' ),__('location','dbem')), 'dbem_location_attributes_enabled', __( 'Select yes to enable the attributes feature','dbem' ) ); em_options_radio_binary ( sprintf(__( 'Enable %s custom fields?', 'dbem' ),__('location','dbem')), 'dbem_cp_locations_custom_fields', __( 'Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.','dbem' ) ); if( get_option('dbem_location_attributes_enabled') ){ em_options_textarea ( sprintf(__( '%s Attributes', 'dbem' ),__('Location','dbem')), 'dbem_location_placeholders_custom', sprintf(__( "You can also add location attributes here, one per line in this format #_LATT{key}. They will not appear on location pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. More information on placeholders.", 'dbem' ), EM_ADMIN_URL .'&page=events-manager-help') ); } } ?>


Migrate Images From Version 4

You have the option of migrating images from version 4 so they become the equivalent of 'featured images' like with regular WordPress posts and pages and are also available in your media library.

Your event and location images will still display correctly on the front-end even if you don't migrate, but will not show up within your edit location/event pages in the admin area.

Migrate Images
Do Not Migrate Images


*/ ?>


em_event_form() template tag with this enabled.', 'dbem' ) ); em_options_select ( __('Guest Default User', 'dbem'), 'dbem_events_anonymous_user', em_get_wp_users (), __( 'Events require a user to own them. In order to allow events to be submitted anonymously you need to assign that event a specific user. We recommend you create a "Anonymous" subscriber with a very good password and use that. Guests will have the same event permissions as this user when submitting.', 'dbem' ) ); em_options_textarea ( __( 'Success Message', 'dbem' ), 'dbem_events_anonymous_result_success', __( 'Anonymous submitters cannot see or modify their event once submitted. You can customize the success message they see here.', 'dbem' ).$events_placeholder_tip ); ?>
[event_form]'); ?>
[event_form]'); ?>


'SMTP', 'mail' => __( 'PHP mail function', 'dbem' ), 'sendmail' => 'Sendmail', 'qmail' => 'Qmail', 'wp_mail' => 'WP Mail' ), __( 'Select the method to send email notification.', 'dbem' ) ); em_options_radio_binary ( __( 'Use SMTP authentication?', 'dbem' ), 'dbem_rsvp_mail_SMTPAuth', __( 'SMTP authentication is often needed. If you use GMail, make sure to set this parameter to Yes', 'dbem' ) ); em_options_input_text ( 'SMTP host', 'dbem_smtp_host', __( "The SMTP host. Usually it corresponds to 'localhost'. If you use GMail, set this value to 'ssl://smtp.gmail.com:465'.", 'dbem' ) ); em_options_input_text ( __( 'SMTP username', 'dbem' ), 'dbem_smtp_username', __( "Insert the username to be used to access your SMTP server.", 'dbem' ) ); em_options_input_password ( __( 'SMTP password', 'dbem' ), "dbem_smtp_password", __( "Insert the password to be used to access your SMTP server", 'dbem' ) ); echo $save_button; ?>

array( /* Event Capabilities */ 'publish_events' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('events','dbem')), 'delete_others_events' => sprintf(__('User can delete other users %s','dbem'),__('events','dbem')), 'edit_others_events' => sprintf(__('User can edit other users %s','dbem'),__('events','dbem')), 'delete_events' => sprintf(__('User can delete their own %s','dbem'),__('events','dbem')), 'edit_events' => sprintf(__('User can create and edit %s','dbem'),__('events','dbem')), 'read_private_events' => sprintf(__('User can view private %s','dbem'),__('events','dbem')), /*'read_events' => sprintf(__('User can view %s','dbem'),__('events','dbem')),*/ ), sprintf(__('%s Capabilities','dbem'),__('Recurring Event','dbem')) => array( /* Recurring Event Capabilties */ 'publish_recurring_events' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('recurring events','dbem')), 'delete_others_recurring_events' => sprintf(__('User can delete other users %s','dbem'),__('recurring events','dbem')), 'edit_others_recurring_events' => sprintf(__('User can edit other users %s','dbem'),__('recurring events','dbem')), 'delete_recurring_events' => sprintf(__('User can delete their own %s','dbem'),__('recurring events','dbem')), 'edit_recurring_events' => sprintf(__('User can create and edit %s','dbem'),__('recurring events','dbem')) ), sprintf(__('%s Capabilities','dbem'),__('Location','dbem')) => array( /* Location Capabilities */ 'publish_locations' => sprintf(__('Users can publish %s and skip any admin approval','dbem'),__('locations','dbem')), 'delete_others_locations' => sprintf(__('User can delete other users %s','dbem'),__('locations','dbem')), 'edit_others_locations' => sprintf(__('User can edit other users %s','dbem'),__('locations','dbem')), 'delete_locations' => sprintf(__('User can delete their own %s','dbem'),__('locations','dbem')), 'edit_locations' => sprintf(__('User can create and edit %s','dbem'),__('locations','dbem')), 'read_private_locations' => sprintf(__('User can view private %s','dbem'),__('locations','dbem')), 'read_others_locations' => __('User can use other user locations for their events.','dbem'), /*'read_locations' => sprintf(__('User can view %s','dbem'),__('locations','dbem')),*/ ), sprintf(__('%s Capabilities','dbem'),__('Other','dbem')) => array( /* Category Capabilities */ 'delete_event_categories' => sprintf(__('User can delete %s categories and tags.','dbem'),__('event','dbem')), 'edit_event_categories' => sprintf(__('User can edit %s categories and tags.','dbem'),__('event','dbem')), /* Booking Capabilities */ 'manage_others_bookings' => __('User can manage other users individual bookings and event booking settings.','dbem'), 'manage_bookings' => __('User can use and manage bookings with their events.','dbem'), 'upload_event_images' => __('User can upload images along with their events and locations.','dbem') ) ); ?>

role_objects as $role): ?>
 
name; ?> $cap_help){ ?> has_cap($cap) ? 'checked="checked"':''; ?> />   ?