Last active
May 10, 2017 08:37
-
-
Save NateWr/cdbc416cf81a427d7ece5245b798e62c to your computer and use it in GitHub Desktop.
Allow the admin to bypass any scheduling restrictions to make a booking in the backend.
This file contains 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: Allow Admin Override of Scheduling Restrictions for Restaurant Reservations | |
* Plugin URI: http://themeofthecrop.com | |
* Description: Allow the admin to create a booking at any time. | |
* Version: 0.0.1 | |
* 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 | |
*/ | |
defined( 'ABSPATH' ) || exit; | |
add_filter( 'rtb-setting-schedule-open', 'aaosrrtb_modify_schedule_open' ); | |
function aaosrrtb_modify_schedule_open( $schedule_open ) { | |
if ( !is_admin() ) { | |
return $schedule_open; | |
} | |
return array( | |
array( | |
'weekdays' => array( | |
'monday' => 1, | |
'tuesday' => 1, | |
'wednesday' => 1, | |
'thursday' => 1, | |
'friday' => 1, | |
'saturday' => 1, | |
'sunday' => 1, | |
) | |
) | |
); | |
} | |
add_filter( 'rtb-setting-schedule-closed', 'aaosrrtb_modify_schedule_closed' ); | |
function aaosrrtb_modify_schedule_closed( $schedule_closed ) { | |
if ( !is_admin() ) { | |
return $schedule_closed; | |
} | |
return array(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment