Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * This snippet will add new action link at Events > Bookings
- * @param action array $booking_actions
- * @param EM_Booking $EM_Booking
- */
- function em_mod_booking_resend($booking_actions, $EM_Booking){
- $url = $EM_Booking->get_event()->get_bookings_url();
- $booking_actions['send_email'] = '<a class="em-bookings-resend_email" href="'.em_add_get_params($url, array('action'=>'mod_booking_resend_email', 'booking_id'=>$EM_Booking->booking_id)).'">'.__('Re-send Email','dbem').'</a>';
- return $booking_actions;
- }
- add_filter('em_bookings_table_cols_col_action','em_mod_booking_resend',10,2);
- /*
- * This snippet will be responsible for handling request to re-send Booking Emails
- * based on the status of the event.
- */
- function em_mod_booking_resend_action(){
- global $wpdb, $EM_Event, $EM_Booking, $EM_Notices;
- if ( !empty($_REQUEST['action']) && $_REQUEST['action'] == 'mod_booking_resend_email' ){
- if( $EM_Booking->can_manage('manage_bookings','manage_others_bookings') ){
- if( $EM_Booking->email(false, true) ){
- if( $EM_Booking->mails_sent > 0 ) {
- $EM_Notices->add_confirm( __('Email Sent.','dbem'), true );
- }else{
- $EM_Notices->add_confirm( _x('No emails to send for this booking.', 'bookings', 'dbem'), true );
- }
- $redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : wp_get_referer();
- wp_redirect( $redirect );
- exit();
- }else{
- $result = false;
- $EM_Notices->add_error( __('ERROR : Email Not Sent.','dbem') );
- $feedback = $EM_Booking->feedback_message;
- }
- }
- }
- }
- add_action('init','em_mod_booking_resend_action',11);
- /*
- * This snippet will override the booking email templates
- *
- * Status:
- * 0 = Pending
- * 1 = Approved
- * 2 = Rejected
- * 3 = Cancelled
- * 4 = Awaiting Online Payment
- * 5 = Awaiting Payment
- *
- * eg.
- * if ( $EM_Booking->get_status() == 0 ) {} // for Pending bookings
- * if ( $EM_Booking->get_status() == 1 ) {} // for Approved bookings
- *
- */
- function my_event_messages( $msg, $EM_Booking ){
- if ( $EM_Booking->get_status() == 0 ) {
- $msg['user']['subject'] = 'New Subject';
- $msg['user']['body'] = 'New email body';
- }
- return $msg;
- }
- add_filter('em_booking_email_messages','my_event_messages',10,2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement