Skip to content

Instantly share code, notes, and snippets.

@NateWr
Last active May 10, 2017 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NateWr/cdbc416cf81a427d7ece5245b798e62c to your computer and use it in GitHub Desktop.
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.
<?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