Support

Home Forums Event Espresso Premium Email Reservation Lists

Email Reservation Lists

Posted: April 8, 2016 at 1:54 am


Jason Lee

April 8, 2016 at 1:54 am

Hi there,

Is there a way to have reservation lists automatically send out to venues when an event closes in EE3?

We had built a cron job to handle this but it recently broke (we changed our caching system and updated EE3) and it’s a bit of a delay to get the team that built it to assist so I was wondering if that option existed or if something is named incorrectly that we need to update.

The error message our cron is now producing is the following:
[08-Apr-2016 01:00:01 America/New_York] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 for query SELECT * FROM wp_events_venue WHERE id =

The cron we are using is as follows:

<?php
require_once( dirname(__FILE__) . '/wp-config.php' );
global $wpdb;

$table_name = $wpdb->prefix.'events_detail';		
//Display data Query
$rows = $wpdb->get_results("SELECT * FROM $table_name");

//$subject = 'Registration Closed';
$message1 = '<table><tr><td>Hello,</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
$message1 .='<tr height="20px;"></tr>';
$from = get_option('admin_email');
foreach($rows as $row){
  $user_info = get_userdata($row->wp_user);  
  //$to    = $user_info->user_email;
  $where = ' WHERE event_id = '.$row->id; 

  $table_name_vr = $wpdb->prefix.'events_venue_rel'; 
  $rowsvr = $wpdb->get_results("SELECT * FROM $table_name_vr ".$where);
  
  $table_name_send = $wpdb->prefix.'events_start_end'; 
  $rowssend = $wpdb->get_results("SELECT * FROM $table_name_send ".$where);
  
  $where1 = ' WHERE id = '.$rowsvr[0]->venue_id; 

  $table_name_v = $wpdb->prefix.'events_venue'; 
  $rowsv = $wpdb->get_results("SELECT * FROM $table_name_v ".$where1);  

  $serilizeto = unserialize($rowsv[0]->meta); 
  $to    = $serilizeto['contact'];
  $cdt   = date(get_option('date_format').get_option('time_format'));
  $date  = date_create($row->registration_end.' '.$row->registration_endT);  
  $rd    = date_format($date, get_option('date_format'));
  $rt    = date_format($date, get_option('time_format'));  
  $cd    = date(get_option('date_format'));
  $ct    = date(get_option('time_format')); 
  //$ct30p = date(get_option('time_format'), strtotime("+30 minutes"));
  //$ct30m = date(get_option('time_format'), strtotime("-30 minutes")); 
  
  $ct30m = strtotime($cdt . ' - 30 minutes');
  $ct30m = date(get_option('date_format').get_option('time_format'), $ct30m);
  $ct30m = date(get_option('time_format'), strtotime($ct30m));

  $ct30p = strtotime($cdt . ' + 30 minutes');
  $ct30p = date(get_option('date_format').get_option('time_format'), $ct30p);
  $ct30p = date(get_option('time_format'), strtotime($ct30p));

  //$cm   = date(get_option('time_format'),strtotime($rt.' + 1 hour'));
  
  $rdatetime = $rd.$rt; 
  $newtime  = strtotime($rdatetime . ' + 1 hours');
  $newtimed = date(get_option('date_format').get_option('time_format'), $newtime);
  $rdate    = date(get_option('date_format'), strtotime($newtimed));
  $cm       = date(get_option('time_format'), strtotime($newtimed));   
  
  $subject = $row->event_name; 
  $message  = '';
  $message .= '<tr height="20px;"></tr>';
  $message .= '<tr><td>Event Name</td><td>:</td><td>'.$row->event_name.'</td></tr>';  
  $message .= '<tr><td>Start Date</td><td>:</td><td>'.$row->start_date.' '.$rowssend[0]->start_time.'</td></tr>';
  $message .= '<tr><td>End Date</td><td>:</td><td>'.$row->end_date.' '.$rowssend[0]->end_time.'</td></tr>';
  
  
  $table_name_att = $wpdb->prefix.'events_attendee'; 
  $rowsatt = $wpdb->get_results("SELECT * FROM $table_name_att ".$where);
  $sum = 0;
 if(count($rowsatt) > 0){
    $message .='<tr height="20px;"><td align="left" colspan="3">Here is the list of attendees for this event :</td></tr>';
  //$message .= '<tr><td colspan="3"><table border="1"><tr><td>User Name</td><td>User Email</td><td>Amount of Ticket</td></tr>';   
    $message .= '<tr><td colspan="3"><table border="1"><tr><td>User Name</td>';    
    $message .= '<td>Amount of Tickets</td><td width="30%">&nbsp;</td></tr>'; 
        
    foreach($rowsatt as $rowsatt){ 
      $user_login = $rowsatt->fname." ".$rowsatt->lname; 
      $user_email = $rowsatt->email; 
      $amtticket  =  $rowsatt->quantity;
      $sum = $sum + $amtticket;
      $message   .= '<tr><td>'.$user_login.'</td><td>'.$amtticket.'</td><td>&nbsp;</td></tr>';    
     //$message  .= '<tr><td>'.$user_login.'</td><td>'.$user_email.'</td><td>'.$amtticket.'</td></tr>';    
    }
    $message .='</table></td></tr>';
  }
  
  $message .= '<tr height="20px;"></tr>';
  $message .='<tr><td colspan="2">Total Number Of Tickets   : </td><td>'.$sum.'</td></tr>';
  $message .= '<tr height="20px;"></tr>';       
  $message .= '<tr><td>Thanks</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>'; 
  $headers  = "MIME-Version: 1.0" . "\r\n";
  $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
  $headers .= 'From: <'.$from.'>' . "\r\n";

  if($rdate == $cd){  	  
    if(strtotime($cm) == strtotime($ct) || strtotime($ct30m) <= strtotime($cm) && strtotime($cm) <= strtotime($ct30p)){      
        $to = explode(',',$to);
     	for($i=0;$i<count($to);$i++){     
     	  mail($to[$i],$subject,$message1.$message,$headers);
         }     
      echo '<br/>mail sent';
    }else{
      echo '<br/>not sent mail.';
    }
  }
  echo '<br/>not sent mail!';
}
?>

If this is something that we just need to wait and ask the developer, I totally understand but I figured I’d check as we are a bit frantic since we have a ton of events this weekend and don’t want to do manually if possible 🙂


Tony

  • Support Staff

April 8, 2016 at 6:06 am

Hi Jason,

Is there a way to have reservation lists automatically send out to venues when an event closes in EE3?

No that’s not currently supported by Event Espresso.

[08-Apr-2016 01:00:01 America/New_York] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 1 for query SELECT * FROM wp_events_venue WHERE id =

Do ALL (even expired, old, draft, trashed because that query doesn’t care) of your events have a venue assigned to them? It looks like nothing is being returned as a venue id for an event. That’s then breaking the WHERE because “WHERE id = {nothing}” is invalid.

We can’t provide support for this as its custom code, but that’s where I would start checking.

The support post ‘Email Reservation Lists’ 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