Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Edit the file event_table file to show the event status. | Event Espresso - Staging Server

Support

Home Forums Custom Files Edit the file event_table file to show the event status.

Edit the file event_table file to show the event status.

Posted: June 10, 2013 at 7:13 am

Viewing 3 reply threads


Giovanni Barsanti

June 10, 2013 at 7:13 am

Hi there,

I’m using the custom file event_table.php to show my events as rows.

I’ve already edited it to show the event prices and other informations.

I would like to “echo” next to the event name the status, I mean if the event is “closed” or still available to be booked.

I’ve seen the file registration_page_display.php and how to show all the cases.. but, can you please help me telling me how to include a row in the table to show that status ?

I assume I’ve to add a line here

[code language=”php”]

<thead class=”espresso-table-header-row”>

<tr>

<th class=”th-group”><?php _e(‘Course’,’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(‘Price’,’event_espresso’); ?></th>

<th class=”th-group”><?php _e(”,’event_espresso’); ?></th>

</tr>

</thead>

[/code]

something like [code language=”php”] <th class=”th-group”><?php _e(‘Status’,’event_espresso’); ?></th>[/code]

 

and then edit the code below, adding something like..

[code language=”php”]

<tr class=”espresso-table-row”>

<td class=”td-group”>

<?php echo $event->event_status ?>

</td>

[/code]

But if I use this line, it returns only “A”..

————————————————–

event espress : 3.1.33 — wordpress: 3.5.1

Thanks!


Giovanni Barsanti

June 10, 2013 at 10:43 am

Solved!

If someone needs this modification, here is full code for the event_table.php

[code language=”php”]

<?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(‘Date’,’event_espresso’); ?></th>

<th class=”th-group”><?php _e(‘Time’,’event_espresso’); ?></th>

<th class=”th-group”><?php _e(‘Price’,’event_espresso’); ?></th>

<th class=”th-group”><?php _e(”,’event_espresso’); ?></th>

</tr>

</thead>

<tbody>

 

<?php

foreach ($events as $event)

{

//var_dump($event);

//echo var_dump(event_espresso_get_is_active($event->id));

$event_status = event_espresso_get_is_active($event->id);

// [“is_active”]=> string(1) “Y”

// [“event_status”]=> string(1) “A”

$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).'”>Book</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 ?> – <?php echo $event_status[‘display’];?>

</td>

<td class=”td-group”>

<?php echo event_date_display($event->start_date, $format = ‘M d’) ?> – <?php echo event_date_display($event->end_date, $format = ‘M d’) ?>

</td>

<td class=”td-group”>

<?php echo espresso_event_time($event->id, ‘start_time’, get_option(‘time_format’)) ?> to <?php echo espresso_event_time($event->id, ‘end_time’, get_option(‘time_format’)) ?>

</td>

<td class=”td-group”>

<?php echo $currency_symbol ?><?php echo do_shortcode(‘[EVENT_PRICE event_id=”‘.$event->id.'” number=”0″]’);?>

</td>

<td class=”td-group”>

<?php echo $register_button ?>

</td>

</tr>

<?php } //close foreach ?>

</tbody>

</table>

 

<?php

}

[/code]

 

details :

I’ve added [code language=”php”]$event_status = event_espresso_get_is_active($event->id);[/code] in the foreach and then using [code language=”php”]<?php echo $event_status[‘display’];?>[/code] I’ve the status.

Now.. next step it’s to understand how works the mobile app.. ’cause I’ve always the 404..
but.. step by step.. :)


Giovanni Barsanti

June 10, 2013 at 10:46 am

Sorry for the mess inside the [ code ], but I can’t edit anymore the post..


Dean

  • Support Staff

June 11, 2013 at 12:22 am

Hi Giovanni,

I’m glad you got it working and thanks for sharing!

Viewing 3 reply threads

The support post ‘Edit the file event_table file to show the event status.’ 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 - Staging Server