$titles[] = get_the_title($event_id); } echo '<div class="updated"><p>' . sprintf(__('%s approved', 'gam-event-manager'), '"' . implode('", "', $titles) . '"') . '</p></div>'; } else { echo '<div class="updated"><p>' . sprintf(__('%s approved', 'gam-event-manager'), '"' . get_the_title($approved_events) . '"') . '</p></div>'; } } } /** * Show a notice if we did a bulk action or approval */ public function expired_notice() { global $post_type, $pagenow; if ($pagenow == 'edit.php' && $post_type == 'event_listing' && !empty($_REQUEST['expired_events'])) { $expired_events = $_REQUEST['expired_events']; if (is_array($expired_events)) { $expired_events = array_map('absint', $expired_events); $titles = array(); foreach ($expired_events as $event_id) { $titles[] = get_the_title($event_id); } echo '<div class="updated"><p>' . sprintf(__('%s expired', 'gam-event-manager'), '"' . implode('", "', $titles) . '"') . '</p></div>'; } else { echo '<div class="updated"><p>' . sprintf(__('%s expired', 'gam-event-manager'), '"' . get_the_title($expired_events) . '"') . '</p></div>'; }
return true; } } /** * True if an the user can post a event. If accounts are required, and reg is enabled, users can post (they signup at the same time). * * @return bool */ function event_manager_user_can_post_event() { $can_post = true; if (!is_user_logged_in()) { if (event_manager_user_requires_account() && !event_manager_enable_registration()) { $can_post = false; } } return apply_filters('event_manager_user_can_post_event', $can_post); } /** * True if an the user can edit a event. * * @return bool */ function event_manager_user_can_edit_event($event_id) { $can_edit = true; if (!is_user_logged_in() || !$event_id) { $can_edit = false; } else { $event = get_post($event_id); if (!$event || absint($event->post_author) !== get_current_user_id() && !current_user_can('edit_post', $event_id)) { $can_edit = false; } } return apply_filters('event_manager_user_can_edit_event', $can_edit, $event_id); } /** * True if registration is enabled. * * @return bool */ function event_manager_enable_registration() { return apply_filters('event_manager_enable_registration', get_option('event_manager_enable_registration') == 1 ? true : false);