Posted: October 9, 2013 at 1:24 pm
|
Back again, I didn’t want to make another thread but I might as well if someone else runs into the same issue and is searching for it. I’ve got an event setup that uses an alternate registration page, but when I click on the ‘view details’ link generated in the espresso table it takes me to the default registration page for the event. Is there a way to change that, so that it will go to the alternate registration page instead? If I click the view details link for the same event on the Course Calendar it links to the alternate page, so I’d assume there is a way with some php changes. Thanks again! |
|
Which table shortcode are you using? There are several tables available and I want to make sure I’m looking at the right one before I look at the code. |
|
I’m referring to the espresso_table.php that is in the custom files add on. |
|
Change line 162 and 163 of that file from: $ee_base_reg_url = home_url() . '/' . espresso_get_ee_slug(); $register_url = $ee_base_reg_url . '/?ee=' . $event->id; to: if (empty($event->externalURL)) { $ee_base_reg_url = home_url() . '/' . espresso_get_ee_slug(); $register_url = $ee_base_reg_url . '/?ee=' . $event->id; } else { $register_url = $event->externalURL; } Be careful if you copy and paste from here to remove the line numbers that the forum software generates. |
|
Sorry for the late response, I am not seeing any of that code in my espresso_table.php file from the custom files addon (DL’d it again from the site to make sure it was up to date). Mine is only 132 lines and I searched through it (in case your file was spaced out more and took up more lines) and couldn’t find the code that needs to be changed anywhere. I’ll just paste the code from the file I am talking about to avoid confusion: <code><?php /* Shortcode Name: Espresso Table Author: Seth Shoultes Contact: seth@eventespresso.com Website: http://www.eventespresso.com Description: Only show events in a CATEGORY within a certain number number of days into the future and a qty. The example below only shows events in a certain category that start within 30 days from the current date. Usage Example: [ESPRESSO_TABLE max_days="30" qty="3" category_id="gracecard" order_by="state"] Custom CSS for the table display Notes: This file should be stored in your "/wp-content/uploads/espresso/templates/" folder and you should have the custom_includes.php files installed in your "/wp-content/uploads/espresso/" directory. */ function espresso_display_table($atts){ global $wpdb; $org_options = get_option('events_organization_settings'); $event_page_id =$org_options['event_page_id']; global $load_espresso_scripts; $load_espresso_scripts = true;//This tells the plugin to load the required scripts extract(shortcode_atts(array('event_category_id'=>'NULL','category_identifier' => 'NULL','show_expired' => 'false', 'show_secondary'=>'false','show_deleted'=>'false','show_recurrence'=>'true', 'limit' => '0', 'order_by' => 'NULL', 'max_days'=>''),$atts)); if ($category_identifier != 'NULL'){ $type = 'category'; } $show_expired = $show_expired == 'false' ? " AND e.start_date >= '".date ( 'Y-m-d' )."' " : ''; $show_secondary = $show_secondary == 'false' ? " AND e.event_status != 'S' " : ''; $show_deleted = $show_deleted == 'false' ? " AND e.event_status != 'D' " : ''; $show_recurrence = $show_recurrence == 'false' ? " AND e.recurrence_id = '0' " : ''; $limit = $limit > 0 ? " LIMIT 0," . $limit . " " : ''; $order_by = $order_by != 'NULL'? " ORDER BY ". $order_by ." ASC " : " ORDER BY date(start_date), id ASC "; if ($type == 'category'){ $sql = "SELECT e.* FROM " . EVENTS_CATEGORY_TABLE . " c "; $sql .= " JOIN " . EVENTS_CATEGORY_REL_TABLE . " r ON r.cat_id = c.id "; $sql .= " JOIN " . EVENTS_DETAIL_TABLE . " e ON e.id = r.event_id "; $sql .= " WHERE c.category_identifier = '" . $category_identifier . "' "; $sql .= " AND e.is_active = 'Y' "; }else{ $sql = "SELECT e.* FROM " . EVENTS_DETAIL_TABLE . " e "; $sql .= " WHERE e.is_active = 'Y' "; } if ($max_days != ""){ $sql .= " AND ADDDATE('".date ( 'Y-m-d' )."', INTERVAL ".$max_days." DAY) >= e.start_date AND e.start_date >= '".date ( 'Y-m-d' )."' "; } $sql .= $show_expired; $sql .= $show_secondary; $sql .= $show_deleted; $sql .= $show_recurrence; $sql .= $order_by; $sql .= $limit; echo espresso_get_table($sql); } //Events Custom Table Listing - Shows the events on your page in matching table. function espresso_get_table($sql){ 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>' . stripslashes_deep($category_desc) . '</p>'; } ?> <table class="espresso-table" width="100%"> <thead class="espresso-table-header-row"> <tr> <th class="th-group"><?php _e('Course','event_espresso'); ?></th> <th class="th-group"><?php _e('Location','event_espresso'); ?></th> <th class="th-group"><?php _e('City','event_espresso'); ?></th> <th class="th-group"><?php _e('State','event_espresso'); ?></th> <th class="th-group"><?php _e('Date','event_espresso'); ?></th> <th class="th-group"><?php _e('Time','event_espresso'); ?></th> <th class="th-group"><?php _e('','event_espresso'); ?></th> </tr> </thead> <tbody> <?php foreach ($events as $event){ $reg_limit = $event->reg_limit; $event_desc = wpautop($event->event_desc); $register_button = '<a id="a_register_link-'.$event->id.'" href="'.get_option('siteurl').'/?page_id='.$event_page_id.'&regevent_action=register&event_id='.$event->id.'&name_of_event='.stripslashes_deep($event->event_name).'">Register</a>'; //Check to see how many open spots are available $open_spots = get_number_of_attendees_reg_limit($event->id, 'available_spaces') == 'Unlimited' ? 999 : get_number_of_attendees_reg_limit($event->id, 'available_spaces'); //echo $open_spots; if ( $open_spots < 1 ) { $live_button = 'Closed'; } ?> <tr class="espresso-table-row"> <td class="td-group"> <?php echo $event->event_name ?> </td> <td class="td-group"> <?php echo $event->address ?> </td> <td class="td-group"> <?php echo $event->city ?> </td> <td class="td-group"> <?php echo $event->state ?> </td> <td class="td-group"> <?php echo event_date_display($event->start_date, $format = 'l, M d, Y') ?> </td> <td class="td-group"> <?php echo espresso_event_time($event->id, 'start_time', get_option('time_format')) ?> </td> <td class="td-group"> <?php echo $register_button ?> </td> </tr> <?php } //close foreach ?> </tbody> </table> <?php }</code> Thanks |
|
Used the code tag above the text editor…sorry about that, this should work: [code language=”php”] global $load_espresso_scripts; if ($category_identifier != ‘NULL’){ $show_expired = $show_expired == ‘false’ ? ” AND e.start_date >= ‘”.date ( ‘Y-m-d’ ).”‘ ” : ”; if ($type == ‘category’){ echo espresso_get_table($sql); } $category_name = $wpdb->last_result[0]->category_name; <thead class=”espresso-table-header-row”> <?php foreach ($events as $event){ $event_desc = wpautop($event->event_desc); $register_button = ‘id.'” href=”‘.get_option(‘siteurl’).’/?page_id=’.$event_page_id.’®event_action=register&event_id=’.$event->id.’&name_of_event=’.stripslashes_deep($event->event_name).'”>Register‘; //Check to see how many open spots are available if ( $open_spots < 1 ) { $live_button = ‘Closed’; } ?> <td class=”td-group”> <?php |
|
Yours is actually on line 93 of that file, where it says: $register_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_deep($event->event_name).'">Register</a>'; it should be: if (empty($event->externalURL)) { $register_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_deep($event->event_name).'">Register</a>'; } else { $register_button = '<a id="a_register_link-'.$event->id.'" href="'. $event->externalURL.'">Register</a>'; } |
|
Alright, I copied the code in after removing the numbers via notepad and when I click view details in the second table at: http://events.infosol.com/testing-page/ (alternate reg page is just set to googles homepage) It tries to take me to: http://events.infosol.com/testing-page/www.google.com So it’s got the alternate reg URL, but it’s adding it on to the end of the page that the table shortcode is on. Thanks again, almost there! |
|
Disregard that, I figured it out. If you don’t use the full URL with http:// on the alternate registration link section, it screws up what page it redirects to. Everything works how it should now, thank you very much! |
The support post ‘espresso table View Details does not link to alternate registration page’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.