Last active
August 23, 2019 08:46
-
-
Save NateWr/00ee083db4d357aeab68 to your computer and use it in GitHub Desktop.
Automatically confirm new booking requests for Restaurant Reservations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Auto-confirm New Bookings for Restaurant Reservations | |
* Plugin URI: http://themeofthecrop.com | |
* Description: Automatically confirm new booking requests. | |
* Version: 1.0 | |
* Author: Theme of the Crop | |
* Author URI: http://themeofthecrop.com | |
* License: GNU General Public License v2.0 or later | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* | |
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU | |
* General Public License as published by the Free Software Foundation; either version 2 of the License, | |
* or (at your option) any later version. | |
* | |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | |
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
* | |
* You should have received a copy of the GNU General Public License along with this program; if not, write | |
* to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) | |
exit; | |
/** | |
* Automatically confirm new bookings when they are added to the | |
* database. | |
*/ | |
add_filter( 'rtb_insert_booking_data', 'rtbcnb_confirm_new_bookings', 10, 2 ); | |
function rtbcnb_confirm_new_bookings( $args, $booking ) { | |
if ( empty( $booking->ID ) ) { | |
$args['post_status'] = 'confirmed'; | |
} | |
return $args; | |
} |
@NateWr
So, the email issue I have is that the administrator is not getting emails.
Everything else works fine, client gets email notification, and the reservation is auto-confirmed.
Configuration seems perfect. I have no clue why the "restaurant" does not receive emails.
Problem solved: it was NOT a plugin issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@MiriShehu and @iWebbers, sorry for the late reply. GitHub doesn't send notifications about comments in gists.
The plugin will still send the "New Request Email" under Bookings > Settings > Notifications. So you can adjust that email to reflect that the booking has been accepted.