slug) ){
$_REQUEST['category_id'] = $term->slug;
}
}
//hide some cols by default:
$screen = 'edit-'.EM_POST_TYPE_EVENT;
$hidden = get_user_option( 'manage' . $screen . 'columnshidden' );
if( !$hidden ){
$hidden = array('event-id');
update_user_option(get_current_user_id(), "manage{$screen}columnshidden", $hidden, true);
}
//deal with actions
$row_action_type = is_post_type_hierarchical( EM_POST_TYPE_EVENT ) ? 'page_row_actions' : 'post_row_actions';
add_filter($row_action_type, array('EM_Event_Posts_Admin','row_actions'),10,2);
add_action('admin_head', array('EM_Event_Posts_Admin','admin_head'));
//collumns
add_filter('manage_edit-'.EM_POST_TYPE_EVENT.'_columns' , array('EM_Event_Posts_Admin','columns_add'));
add_filter('manage_'.EM_POST_TYPE_EVENT.'_posts_custom_column' , array('EM_Event_Posts_Admin','columns_output'),10,2 );
//TODO alter views of locations, events and recurrences, specifically find a good way to alter the wp_count_posts method to force user owned posts only
//add_filter('views_edit-'.EM_POST_TYPE_EVENT, array('EM_Event_Posts_Admin','views'),10,1);
}
add_action('restrict_manage_posts', array('EM_Event_Posts_Admin','restrict_manage_posts'));
}
function admin_head(){
//quick hacks to make event admin table make more sense for events
?>
query_vars['post_type'] == EM_POST_TYPE_EVENT || $wp_query->query_vars['post_type'] == 'event-recurring' ){
?>
1, 'name' => 'event-categories',
'hierarchical' => true, 'id' => EM_TAXONOMY_CATEGORY,
'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected,
'show_option_all' => __('View all categories')));
}
if( !empty($_REQUEST['author']) ){
?>
$cb, 'event-id' => sprintf(__('%s ID','dbem'),__('Event','dbem')));
}else{
$id_array = array('event-id' => sprintf(__('%s ID','dbem'),__('Event','dbem')));
}
unset($columns['comments']);
unset($columns['date']);
unset($columns['author']);
$columns = array_merge($id_array, $columns, array(
'location' => __('Location','dbem'),
'date-time' => __('Date and Time','dbem'),
'author' => __('Owner','dbem'),
'extra' => ''
));
if( !get_option('dbem_locations_enabled') ){
unset($columns['location']);
}
return $columns;
}
function columns_output( $column ) {
global $post, $EM_Event;
$EM_Event = em_get_event($post, 'post_id');
/* @var $post EM_Event */
switch ( $column ) {
case 'event-id':
echo $EM_Event->event_id;
break;
case 'location':
//get meta value to see if post has location, otherwise
$EM_Location = $EM_Event->get_location();
if( !empty($EM_Location->location_id) ){
echo "" . $EM_Location->location_name . "
" . $EM_Location->location_address . " - " . $EM_Location->location_town;
}else{
echo __('None','dbem');
}
break;
case 'date-time':
//get meta value to see if post has location, otherwise
$localised_start_date = date_i18n(get_option('date_format'), $EM_Event->start);
$localised_end_date = date_i18n(get_option('date_format'), $EM_Event->end);
echo $localised_start_date;
echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'';
echo "
";
if(!$EM_Event->event_all_day){
echo date_i18n(get_option('time_format'), $EM_Event->start) . " - " . date_i18n(get_option('time_format'), $EM_Event->end);
}else{
echo get_option('dbem_event_all_day_message');
}
break;
case 'extra':
if( get_option('dbem_rsvp_enabled') == 1 && !empty($EM_Event->event_rsvp) && $EM_Event->can_manage('manage_bookings','manage_others_bookings')){
?>
–
: get_bookings()->get_booked_spaces()."/".$EM_Event->get_spaces(); ?>
| : get_bookings()->get_pending_spaces(); ?>
is_recurrence()) ? '
':'';
}
if ( $EM_Event->is_recurrence() && $EM_Event->can_manage('edit_recurring_events','edit_others_recurring_events') ) {
$recurrence_delete_confirm = __('WARNING! You will delete ALL recurrences of this event, including booking history associated with any event in this recurrence. To keep booking information, go to the relevant single event and save it to detach it from this recurrence series.','dbem');
?>
get_recurrence_description(); ?>