function event_espresso_get_event_list_table($sql) { event_espresso_session_start(); if (!isset($_SESSION['event_espresso_sessionid'])) { $sessionid = mt_rand(100, 999) . time(); $_SESSION['event_espresso_sessionid'] = $sessionid; } //print_r( $_SESSION['event_espresso_sessionid']); //See if the session already exists global $wpdb; //echo 'This page is located in ' . get_option( 'upload_path' ); $org_options = get_option('events_organization_settings'); $event_page_id = $org_options['event_page_id']; $currency_symbol = $org_options['currency_symbol']; $events = $wpdb->get_results($sql); $category_name = $wpdb->last_result[0]->category_name; $category_desc = $wpdb->last_result[0]->category_desc; $display_desc = $wpdb->last_result[0]->display_desc; if ($display_desc == 'Y') { echo '<p>' . htmlspecialchars_decode($category_name) . '</p>'; echo '<p>' . htmlspecialchars_decode($category_desc) . '</p>'; } //If the members addon is installed, get the users information if available if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "members/member_functions.php")) { if (get_option('events_members_active') == 'true') { require_once EVENT_ESPRESSO_MEMBERS_DIR . "member_functions.php"; //Load Members functions } } if (!is_user_logged_in() && get_option('events_members_active') == 'true' && $member_only == 'Y') { //Display a message if the user is not logged in. //_e('Member Only Event. Please ','event_espresso') . event_espresso_user_login_link() . '.'; } else { ?> <div class="pagination"> Viewing all member only reservation times for the next 10 days. </div> <table class="forum"> <tr> <th id="th-group"><?php _e('Event Date', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Start Time', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Description', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Open Spots', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Register Link', 'event_espresso'); ?> </th> <th id="th-group"><?php _e('Boat Captain?', 'event_espresso'); ?> </th> </tr> <?php foreach ($events as $event) { $event_id = $event->id; $event_name = $event->event_name; $event_desc = $event->event_desc; $event_identifier = $event->event_identifier; $active = $event->is_active; $start_date = $event->start_date; $start_time = $event->start_time; $reg_limit = $event->reg_limit; $event_address = $event->address; $member_only = $event->member_only; $event_desc = strip_tags(html_entity_decode($event_desc)); $live_button = '<a id="a_register_link-' . $event_id . '" href="' . get_option('siteurl') . '/?page_id=' . $event_page_id . '®event_action=register&event_id=' . $event_id . '&name_of_event=' . stripslashes($event_name) . '">Reserve Spot</a>'; $open_spots = get_number_of_attendees_reg_limit($event_id, 'available_spaces'); if ($open_spots < 1) { $live_button = 'Closed'; } ?> <tr class=""> <td class="td-group"> <?php echo event_date_display($start_date); ?> </td> <td class="td-group"> <?php echo $start_time; ?> </td> <td class="td-group"> <?php echo $event_desc; ?> </td> <td class="td-group"> <?php echo $open_spots; ?> </td> <td class="td-group"> <?php echo $live_button; ?> </td> <td class="td-group"> No Captain yet </td> </tr> <?php } //close foreach ?> </table> <?php // close is_user_logged_in } }
function event_espresso_get_event_details($sql) { event_espresso_session_start(); if (!isset($_SESSION['event_espresso_sessionid'])) { $sessionid = mt_rand(100, 999) . time(); $_SESSION['event_espresso_sessionid'] = $sessionid; } global $wpdb, $org_options; //echo 'This page is located in ' . get_option( 'upload_path' ); $event_page_id = $org_options['event_page_id']; $currency_symbol = $org_options['currency_symbol']; $events = $wpdb->get_results($sql); $category_name = $wpdb->last_result[0]->category_name; $category_desc = $wpdb->last_result[0]->category_desc; $display_desc = $wpdb->last_result[0]->display_desc; if ($display_desc == 'Y') { echo '<p>' . stripslashes_deep($category_name) . '</p>'; echo '<p>' . wpautop($category_desc) . '</p>'; } foreach ($events as $event) { $event_id = $event->id; $event_name = $event->event_name; $event_identifier = $event->event_identifier; $active = $event->is_active; $registration_start = $event->registration_start; $registration_end = $event->registration_end; $start_date = $event->start_date; $reg_limit = $event->reg_limit; $event_address = $event->address; $member_only = $event->member_only; $externalURL = $event->externalURL; $registration_url = $externalURL != '' ? $externalURL : get_option('siteurl') . '/?page_id=' . $event_page_id . '®event_action=register&event_id=' . $event_id . '&name_of_event=' . stripslashes_deep($event_name); if (!is_user_logged_in() && get_option('events_members_active') == 'true' && $member_only == 'Y') { //Display a message if the user is not logged in. //_e('Member Only Event. Please ','event_espresso') . event_espresso_user_login_link() . '.'; } else { if ($start_date >= date('Y-m-d') && $registration_start <= date('Y-m-d') && $registration_end >= date('Y-m-d') || $event->event_status == 'O' && $registration_start <= date('Y-m-d')) { ?> <div id="div_event_data-<?php echo $event_id; ?> " class="event_data"> <h3 id="h3_event_title-<?php echo $event_id; ?> " class="event_title"><a id="a_event_title-<?php echo $event_id; ?> " class="a_event_title" href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $event_page_id; ?> ®event_action=register&event_id=<?php echo $event_id; ?> &name_of_event=<?php echo stripslashes_deep($event_name); ?> "><?php echo stripslashes_deep($event_name); ?> </a></h3> <p id="p_event_price-<?php echo $event_id; ?> " class="event_price"> <?php echo __('Price: ', 'event_espresso') . event_espresso_get_price($event_id); ?> </p> <p id="p_event_date-<?php echo $event_id; ?> " class="event_date"><?php _e('Date:', 'event_espresso'); ?> <?php echo event_date_display($start_date); ?> </p> <p id="p_event_address-<?php echo $event_id; ?> " class="event_address"><?php _e('Address:', 'event_espresso'); ?> <?php echo $event_address; ?> </p> <p id="p_available_spaces-<?php echo $event_id; ?> " class="available_spaces"><?php _e('Available Spaces:', 'event_espresso'); ?> <?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces'); ?> </p> <p id="p_register_link-<?php echo $event_id; ?> " class="register_link"> <a id="a_register_link-<?php echo $event_id; ?> " class="a_register_link" href="<?php echo get_option('siteurl'); ?> /?page_id=<?php echo $event_page_id; ?> ®event_action=register&event_id=<?php echo $event_id; ?> &name_of_event=<?php echo stripslashes_deep($event_name); ?> "><?php _e('Register Online', 'event_espresso'); ?> </a> </p> </div> <?php } } } //Check to see how many database queries were performed //echo '<p>Database Queries: ' . get_num_queries() .'</p>'; }