Advertisement
Beee

bookings end placeholder

Apr 18th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. // create #_BOOKINGSEND
  4. function em_bookings_end($replace, $EM_Event, $result) {
  5.   if ( $result == '#_BOOKINGSEND' ) {
  6.  
  7.     // IMPORTANT : DST OFFSET MUST BE SET
  8.     $now = date('Y-m-d  H:i:s', strtotime('+2 hours'));
  9.    
  10.     $bookingsend            = "";
  11.     $rsvp                           = '';
  12.     $rsvp                           .= $EM_Event->event_rsvp_date;
  13.     $rsvp                           .= ' ';
  14.     $rsvp                           .= $EM_Event->event_rsvp_time;
  15.     $countdownformat    = date("j M Y H:i:s", strtotime($rsvp));
  16.     $nowstring              = strtotime($now);
  17.     $endstring              = strtotime($rsvp);
  18.    
  19.     if ( !empty($endstring) ) { // if end date is set
  20.         if ( $nowstring > $endstring ) { // if end date has passed
  21.             $replace = "Sorry, it's closed already";
  22.         } else {
  23.             $replace = $countdownformat;
  24.         }
  25.     } else { // if end date is not set
  26.         $replace = "Registrations haven't started yet.";
  27.     }
  28.   }
  29.   return $replace;
  30. }
  31. add_filter('em_event_output_placeholder','em_bookings_end', 1, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement