Support

Home Forums Custom Files Add-on (EE3) espresso table View Details does not link to alternate registration page

espresso table View Details does not link to alternate registration page

Posted: October 9, 2013 at 1:24 pm


infosolwebadmin

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!


Sidney Harrell

October 9, 2013 at 1:37 pm

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.


infosolwebadmin

October 9, 2013 at 2:39 pm

I’m referring to the espresso_table.php that is in the custom files add on.


Sidney Harrell

October 9, 2013 at 4:35 pm

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.


infosolwebadmin

October 17, 2013 at 12:50 pm

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>&lt;?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=&quot;30&quot; qty=&quot;3&quot; category_id=&quot;gracecard&quot; order_by=&quot;state&quot;]
Custom CSS for the table display
Notes: This file should be stored in your &quot;/wp-content/uploads/espresso/templates/&quot; folder and you should have the custom_includes.php files installed in your &quot;/wp-content/uploads/espresso/&quot; directory.
*/
function espresso_display_table($atts){
 	global $wpdb;
	$org_options = get_option(&#039;events_organization_settings&#039;);
	$event_page_id =$org_options[&#039;event_page_id&#039;];

	global $load_espresso_scripts;	
		$load_espresso_scripts = true;//This tells the plugin to load the required scripts
		extract(shortcode_atts(array(&#039;event_category_id&#039;=&gt;&#039;NULL&#039;,&#039;category_identifier&#039; =&gt; &#039;NULL&#039;,&#039;show_expired&#039; =&gt; &#039;false&#039;, &#039;show_secondary&#039;=&gt;&#039;false&#039;,&#039;show_deleted&#039;=&gt;&#039;false&#039;,&#039;show_recurrence&#039;=&gt;&#039;true&#039;, &#039;limit&#039; =&gt; &#039;0&#039;, &#039;order_by&#039; =&gt; &#039;NULL&#039;, &#039;max_days&#039;=&gt;&#039;&#039;),$atts));		
		
		if ($category_identifier != &#039;NULL&#039;){
			$type = &#039;category&#039;;
		}
		
		$show_expired = $show_expired == &#039;false&#039; ? &quot; AND e.start_date &gt;= &#039;&quot;.date ( &#039;Y-m-d&#039; ).&quot;&#039; &quot; : &#039;&#039;;
		$show_secondary = $show_secondary == &#039;false&#039; ? &quot; AND e.event_status != &#039;S&#039; &quot; : &#039;&#039;;
		$show_deleted = $show_deleted == &#039;false&#039; ? &quot; AND e.event_status != &#039;D&#039; &quot; : &#039;&#039;;
		$show_recurrence = $show_recurrence == &#039;false&#039; ? &quot; AND e.recurrence_id = &#039;0&#039; &quot; : &#039;&#039;;
		$limit = $limit &gt; 0 ? &quot; LIMIT 0,&quot; . $limit . &quot; &quot; : &#039;&#039;;
		$order_by = $order_by != &#039;NULL&#039;? &quot; ORDER BY &quot;. $order_by .&quot; ASC &quot; : &quot; ORDER BY date(start_date), id ASC &quot;;
		
		if ($type == &#039;category&#039;){
			$sql = &quot;SELECT e.* FROM &quot; . EVENTS_CATEGORY_TABLE . &quot; c &quot;;
			$sql .= &quot; JOIN &quot; . EVENTS_CATEGORY_REL_TABLE . &quot; r ON r.cat_id = c.id &quot;;
			$sql .= &quot; JOIN &quot; . EVENTS_DETAIL_TABLE . &quot; e ON e.id = r.event_id &quot;;
			$sql .= &quot; WHERE c.category_identifier = &#039;&quot; . $category_identifier . &quot;&#039; &quot;;
			$sql .= &quot; AND e.is_active = &#039;Y&#039; &quot;;
		}else{
			$sql = &quot;SELECT e.* FROM &quot; . EVENTS_DETAIL_TABLE . &quot; e &quot;;
			$sql .= &quot; WHERE e.is_active = &#039;Y&#039; &quot;;
		}
		if ($max_days != &quot;&quot;){
				$sql  .= &quot; AND ADDDATE(&#039;&quot;.date ( &#039;Y-m-d&#039; ).&quot;&#039;, INTERVAL &quot;.$max_days.&quot; DAY) &gt;= e.start_date AND e.start_date &gt;= &#039;&quot;.date ( &#039;Y-m-d&#039; ).&quot;&#039; &quot;;
		}
		$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 &#039;This page is located in &#039; . get_option( &#039;upload_path&#039; );
  $event_page_id = $org_options[&#039;event_page_id&#039;];
  $currency_symbol = $org_options[&#039;currency_symbol&#039;];
  $events = $wpdb-&gt;get_results($sql);
  
  $category_name = $wpdb-&gt;last_result[0]-&gt;category_name;
  $category_desc = $wpdb-&gt;last_result[0]-&gt;category_desc;
  $display_desc = $wpdb-&gt;last_result[0]-&gt;display_desc;
  if ($display_desc == &#039;Y&#039;){
    echo &#039;&lt;p&gt;&#039; . stripslashes_deep($category_name) . &#039;&lt;/p&gt;&#039;;
    echo &#039;&lt;p&gt;&#039; . stripslashes_deep($category_desc) . &#039;&lt;/p&gt;&#039;;        
  }
?&gt;
&lt;table class=&quot;espresso-table&quot; width=&quot;100%&quot;&gt;
  
      &lt;thead class=&quot;espresso-table-header-row&quot;&gt;
      &lt;tr&gt;
          &lt;th class=&quot;th-group&quot;&gt;&lt;?php _e(&#039;Course&#039;,&#039;event_espresso&#039;); ?&gt;&lt;/th&gt;
          &lt;th class=&quot;th-group&quot;&gt;&lt;?php _e(&#039;Location&#039;,&#039;event_espresso&#039;); ?&gt;&lt;/th&gt;
          &lt;th class=&quot;th-group&quot;&gt;&lt;?php _e(&#039;City&#039;,&#039;event_espresso&#039;); ?&gt;&lt;/th&gt;
          &lt;th class=&quot;th-group&quot;&gt;&lt;?php _e(&#039;State&#039;,&#039;event_espresso&#039;); ?&gt;&lt;/th&gt;
          &lt;th class=&quot;th-group&quot;&gt;&lt;?php _e(&#039;Date&#039;,&#039;event_espresso&#039;); ?&gt;&lt;/th&gt;
          &lt;th class=&quot;th-group&quot;&gt;&lt;?php _e(&#039;Time&#039;,&#039;event_espresso&#039;); ?&gt;&lt;/th&gt;
          &lt;th class=&quot;th-group&quot;&gt;&lt;?php _e(&#039;&#039;,&#039;event_espresso&#039;); ?&gt;&lt;/th&gt;
     &lt;/tr&gt;
      &lt;/thead&gt;
	&lt;tbody&gt;

      &lt;?php
      
      foreach ($events as $event){
	      $reg_limit = $event-&gt;reg_limit;
      
    
    $event_desc = wpautop($event-&gt;event_desc);
    
    $register_button = &#039;&lt;a id=&quot;a_register_link-&#039;.$event-&gt;id.&#039;&quot; href=&quot;&#039;.get_option(&#039;siteurl&#039;).&#039;/?page_id=&#039;.$event_page_id.&#039;&amp;regevent_action=register&amp;event_id=&#039;.$event-&gt;id.&#039;&amp;name_of_event=&#039;.stripslashes_deep($event-&gt;event_name).&#039;&quot;&gt;Register&lt;/a&gt;&#039;;
    
	//Check to see how many open spots are available
    $open_spots = get_number_of_attendees_reg_limit($event-&gt;id, &#039;available_spaces&#039;) == &#039;Unlimited&#039; ? 999 : get_number_of_attendees_reg_limit($event-&gt;id, &#039;available_spaces&#039;);
	//echo $open_spots;
	
    if ( $open_spots &lt; 1 ) { $live_button = &#039;Closed&#039;;  }
    
      ?&gt;
      &lt;tr class=&quot;espresso-table-row&quot;&gt;
       	&lt;td class=&quot;td-group&quot;&gt;
            &lt;?php echo $event-&gt;event_name ?&gt;
          &lt;/td&gt;	
          &lt;td class=&quot;td-group&quot;&gt;
            &lt;?php echo $event-&gt;address ?&gt;
          &lt;/td&gt;
          &lt;td class=&quot;td-group&quot;&gt;
            &lt;?php echo $event-&gt;city ?&gt;
          &lt;/td&gt;
      	  &lt;td class=&quot;td-group&quot;&gt;
            &lt;?php echo $event-&gt;state ?&gt;
          &lt;/td&gt;
          &lt;td class=&quot;td-group&quot;&gt;
              &lt;?php echo event_date_display($event-&gt;start_date, $format = &#039;l, M d, Y&#039;) ?&gt;
          &lt;/td&gt;
          &lt;td class=&quot;td-group&quot;&gt;
              &lt;?php echo espresso_event_time($event-&gt;id, &#039;start_time&#039;, get_option(&#039;time_format&#039;)) ?&gt;
          &lt;/td&gt;
         
          &lt;td class=&quot;td-group&quot;&gt;
              &lt;?php echo $register_button ?&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;?php } //close foreach ?&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;?php
}</code>

Thanks


infosolwebadmin

October 17, 2013 at 12:52 pm

Used the code tag above the text editor…sorry about that, this should work:

[code language=”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 = ‘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‘;

//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]


Sidney Harrell

October 17, 2013 at 5:21 pm

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.'&regevent_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.'&regevent_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>';
}


infosolwebadmin

October 18, 2013 at 1:24 pm

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!


infosolwebadmin

October 18, 2013 at 4:04 pm

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.

Event Espresso