Implement Phase 7: Contact Form 7 Integration (v0.7.0)
All checks were successful
Create Release Package / build-release (push) Successful in 1m1s
All checks were successful
Create Release Package / build-release (push) Successful in 1m1s
Add custom CF7 form tags for booking requests: - [bnb_building_select] - Building filter dropdown - [bnb_room_select] - Room selection with capacity data - [bnb_date_checkin/checkout] - Date pickers with validation - [bnb_guests] - Guest count with capacity limits Features: - Server-side validation for all fields - Real-time AJAX availability checking - Automatic price calculation display - Booking creation on form submission - Guest record creation/linking - Custom mail tags for CF7 templates Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
149
README.md
149
README.md
@@ -18,13 +18,14 @@ WP BnB Management enables WordPress to act as a full management system for B&B h
|
||||
- **Frontend Integration**: Gutenberg blocks, widgets, and shortcodes
|
||||
- **Auto-Updates**: Automatic update checks and installation from license server
|
||||
- **Development Mode**: License bypass for local development environments
|
||||
- **Contact Form 7 Integration**: Accept booking requests through forms (planned)
|
||||
- **Contact Form 7 Integration**: Accept booking requests and inquiries through CF7 forms
|
||||
|
||||
### Requirements
|
||||
|
||||
- WordPress 6.0 or higher
|
||||
- PHP 8.3 or higher
|
||||
- Valid license key
|
||||
- Contact Form 7 (optional, for booking forms)
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -143,6 +144,152 @@ Available sidebar widgets:
|
||||
- **Building Rooms** - List all rooms in a building
|
||||
- **Availability Calendar** - Mini calendar showing booking status
|
||||
|
||||
## Contact Form 7 Integration
|
||||
|
||||
The plugin integrates with Contact Form 7 to accept booking requests and inquiries. Custom form tags are provided for room selection, date pickers, and guest counts.
|
||||
|
||||
### Custom Form Tags
|
||||
|
||||
Use these tags in your CF7 forms:
|
||||
|
||||
- `[bnb_building_select name]` - Building dropdown (optional filter for rooms)
|
||||
- `[bnb_room_select* name]` - Room dropdown with capacity data
|
||||
- `[bnb_date_checkin* name]` - Check-in date picker
|
||||
- `[bnb_date_checkout* name]` - Check-out date picker
|
||||
- `[bnb_guests* name]` - Guest count input
|
||||
|
||||
### Tag Options
|
||||
|
||||
**`[bnb_building_select]`**:
|
||||
|
||||
- `first_as_label:"text"` - Placeholder text (default: "All Locations")
|
||||
|
||||
**`[bnb_room_select]`**:
|
||||
|
||||
- `building_field:"name"` - Link to building field for filtering
|
||||
- `first_as_label:"text"` - Placeholder text (default: "Select Room")
|
||||
|
||||
**`[bnb_guests]`**:
|
||||
|
||||
- `min:N` - Minimum guests (default: 1)
|
||||
- `max:N` - Maximum guests (default: 10)
|
||||
- `default:N` - Default value (default: 1)
|
||||
|
||||
### Example Booking Form
|
||||
|
||||
```txt
|
||||
<div class="wp-bnb-booking-form">
|
||||
<h3>Book Your Stay</h3>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
[bnb_building_select building first_as_label:"All Locations"]
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
[bnb_room_select* room building_field:"building" first_as_label:"Select a Room"]
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-form-row-2col">
|
||||
<div class="wp-bnb-form-field">
|
||||
<label>Check-in</label>
|
||||
[bnb_date_checkin* check_in]
|
||||
</div>
|
||||
<div class="wp-bnb-form-field">
|
||||
<label>Check-out</label>
|
||||
[bnb_date_checkout* check_out]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-availability-status"></div>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
<label>Number of Guests</label>
|
||||
[bnb_guests* guests min:1 max:10 default:2]
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-price-display"></div>
|
||||
|
||||
<h4>Your Information</h4>
|
||||
|
||||
<div class="wp-bnb-form-row-2col">
|
||||
<div class="wp-bnb-form-field">
|
||||
<label>First Name</label>
|
||||
[text* first_name]
|
||||
</div>
|
||||
<div class="wp-bnb-form-field">
|
||||
<label>Last Name</label>
|
||||
[text* last_name]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
<label>Email</label>
|
||||
[email* your_email]
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
<label>Phone</label>
|
||||
[tel your_phone]
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
<label>Message</label>
|
||||
[textarea your_message]
|
||||
</div>
|
||||
|
||||
[submit "Request Booking"]
|
||||
</div>
|
||||
```
|
||||
|
||||
### Example Inquiry Form
|
||||
|
||||
For room-specific inquiries, add the `wp-bnb-inquiry-form` class:
|
||||
|
||||
```txt
|
||||
<div class="wp-bnb-inquiry-form">
|
||||
<h3>Inquire About This Room</h3>
|
||||
|
||||
[hidden room default:123]
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
<label>Your Name</label>
|
||||
[text* your_name]
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
<label>Email</label>
|
||||
[email* your_email]
|
||||
</div>
|
||||
|
||||
<div class="wp-bnb-form-row">
|
||||
<label>Your Question</label>
|
||||
[textarea* your_message]
|
||||
</div>
|
||||
|
||||
[submit "Send Inquiry"]
|
||||
</div>
|
||||
```
|
||||
|
||||
### Form Features
|
||||
|
||||
- **Availability Checking**: Real-time AJAX validation shows room availability
|
||||
- **Price Display**: Estimated total calculated and displayed automatically
|
||||
- **Room Filtering**: Rooms filter by building selection
|
||||
- **Date Validation**: Check-out must be after check-in, no past dates
|
||||
- **Capacity Validation**: Guest count validated against room capacity
|
||||
- **Automatic Booking**: Booking record created with "pending" status on submission
|
||||
- **Guest Linking**: Guest records created or linked by email address
|
||||
|
||||
### Custom Mail Tags
|
||||
|
||||
Use these in your CF7 mail templates:
|
||||
|
||||
- `[_bnb_room_name]` - Room title
|
||||
- `[_bnb_building_name]` - Building name
|
||||
- `[_bnb_calculated_price]` - Formatted price
|
||||
- `[_bnb_nights]` - Number of nights
|
||||
- `[_bnb_booking_reference]` - Booking reference (after creation)
|
||||
|
||||
## Hooks and Filters
|
||||
|
||||
Developers can customize behavior using these hooks:
|
||||
|
||||
Reference in New Issue
Block a user