Модуль Auth
Особистий кабінет клієнта (Customer Panel) є в тарифах Pro та Elite. У тарифах Free і Starter його немає. Реєстрація клієнтів під час бронювання доступна починаючи з тарифу Starter. Див. таблицю тарифів.
Огляд
Baza Booking Calendar Auth є повнофункціональним модулем автентифікації для WordPress, який забезпечує лаконічну та зручну систему облікових записів.
Він включає в себе вхід у систему, реєстрацію та особисту панель управління з окремими розділами для управління профілем, бронюваннями та функціями програми лояльності.
Цей модуль повністю відповідає стандартам WordPress і може бути налаштований за допомогою фільтрів та дій.
Структура URL-адреси
Після активації плагін «Baza Booking Calendar Auth» автоматично створює лаконічні та інтуїтивно зрозумілі URL-адреси:
- /account/: головна сторінка облікового запису
- /account/login/: форма входу
- /account/register/: форма реєстрації
- /account/lostpassword/: сторінка для відновлення пароля
- /account/resetpass/: сторінка для скидання пароля
- /account/dashboard/: особиста панель користувача
- /account/dashboard/bookings/: мої бронювання
- /account/dashboard/loyalty/: програма лояльності
- /account/dashboard/profile/: налаштування профілю
Така структура забезпечує послідовність навігації для користувачів та сприяє оптимізації сайту для пошукових систем.
Основні функції
Baza Booking Calendar Auth надає всі необхідні функції для управління обліковим записом:
- Безпечна реєстрація користувачів із перевіркою даних та повідомленнями на електронну пошту
- Вхід та вихід із системи за допомогою вбудованої системи автентифікації WordPress
- Панель управління користувача з декількома вкладками та гнучкою навігацією
- Редагування профілю (ім’я, електронна пошта, телефон тощо)
- Зміна пароля з перевіркою в режимі реального часу
- Видалення облікового запису з підтвердженням пароля
- Перезапис URL-адрес





Баланс акаунту
Баланс облікового запису вмикається в розділі «Загальні налаштування» перемикачем «Увімкнути баланс користувача», який активує поповнення, витрачання з балансу та накопичення бонусів для зареєстрованих користувачів.
Після ввімкнення адміністратор може налаштувати мінімальну суму поповнення, термін дії балансу (в днях), мінімальну суму оплати з балансу та відсоток бонусу при поповненні.
Користувачі поповнюють баланс через поточний активний платіжний шлюз прямо з вкладки Баланс. Після поповнення баланс можна використати для оплати бронювання замість повторного проходження через платіжний шлюз.
Кожне поповнення та списання фіксується в історії транзакцій із зазначенням дати, дії та суми.
Після ввімкнення вкладка Баланс стає доступною за адресою /account/dashboard/balance/ поряд з іншими вкладками акаунту (Бронювання, Програма лояльності, Налаштування профілю).
Шорткоди
Модуль підтримує шорткоди для зручного вбудовування. Ви також можете налаштовувати назви полів та підказки у формі за допомогою параметрів шорткоду, наприклад:
[baza_booking_calendar_auth] - displays login and registration forms
[baza_booking_calendar_auth show_welcome="false"] - Disable welcome
[baza_booking_calendar_balance]: outputs the formatted balance, e.g. $150.00
[baza_booking_calendar_balance format="raw"]: just the number 150.00
[baza_booking_calendar_dashboard] - displays the user dashboard
[baza_booking_calendar_dashboard default_tab="profile"] - opens a specific dashboard tab by default
[baza_booking_calendar_auth
redirect="/account/dashboard/"
show_welcome="true"
welcome_text="Welcome Back!"
dashboard_button_text="Go to Dashboard"
login_title="Sign In"
register_title="Create Account"
forgot_password_text="Forgot Password?"
no_account_text="Don't have an account? Register"
have_account_text="Already have an account? Login"
registration_success_text="Registration successful! You can now login."
login_button_text="Sign In"
register_button_text="Sign Up"
username_label="Username or Email"
password_label="Password"
email_label="Email"
confirm_password_label="Confirm Password"
first_name_label="First Name"
last_name_label="Last Name"
remember_me_label="Remember Me"
username_placeholder="Enter your username"
email_placeholder="Enter your email address"
password_placeholder="Enter your password"
first_name_placeholder="Enter your first name"
last_name_placeholder="Enter your last name"
]Доступні дії (хуки)
Форма входу:
- baza_bc_before_login_form: Перед усією формою входу
- baza_bc_before_login_form_fields: Перед полями форми
- baza_bc_after_login_form_fields: Після полів форми
- baza_bc_after_login_form: Після заповнення всієї форми входу
Реєстраційна форма:
- baza_bc_before_register_form: Перед відображенням усієї форми реєстрації
- baza_bc_register_form_start: початок форми (після відкриваючого тегу)
- baza_bc_register_form_after_username: Після поля «Ім’я користувача»
- baza_bc_register_form_after_email: Після поля електронної пошти
- baza_bc_register_form_after_password: Після поля для введення пароля
- baza_bc_register_form_after_password_confirm: Після підтвердження пароля
- baza_bc_register_form_after_first_name: Після імені
- baza_bc_register_form_after_last_name: Після прізвища
- baza_bc_register_form_before_submit: Перед натисканням кнопки «Відправити»
- baza_bc_register_form_after_submit: Після натискання кнопки «Відправити»
- baza_bc_after_register_form: Після заповнення всієї реєстраційної форми
Форма для відновлення пароля:
- baza_bc_before_lostpassword_form: Перед відкриттям форми для відновлення забутого пароля
- baza_bc_before_lostpassword_form_fields: Перед полями форми
- baza_bc_lostpassword_form_before_submit: Перед натисканням кнопки «Відправити»
- baza_bc_lostpassword_form_after_submit: Після натискання кнопки «Відправити»
- baza_bc_after_lostpassword_form_fields: Після полів форми
- baza_bc_after_lostpassword_form: Після заповнення форми для відновлення пароля
Форма для відновлення пароля:
- baza_bc_before_resetpass_form: перед завантаженням усієї форми для скидання пароля
- baza_bc_before_resetpass_form_fields: Перед полями форми
- baza_bc_resetpass_form_before_submit: Перед натисканням кнопки «Відправити»
- baza_bc_resetpass_form_after_submit: Після натискання кнопки «Відправити»
- baza_bc_after_resetpass_form_fields: Після полів форми
- baza_bc_after_resetpass_form: Після заповнення всієї форми для скидання пароля
<?php
/**
* FILTERS
*/
// Modify dashboard tabs
add_filter( 'baza_bc_dashboard_tabs', function( $tabs, $current_tab ) {
$tabs['custom'] = array(
'title' => __( 'Custom Tab', 'textdomain' ),
'url' => home_url( '/account/dashboard/custom/' ),
'order' => 15
);
unset( $tabs['loyalty'] );
return $tabs;
}, 10, 2 );
// Render custom tab content
// Use together with baza_bc_dashboard_tabs to add full custom tab
add_filter( 'baza_bc_dashboard_render_tab', function( $content, $tab ) {
if ( $tab !== 'custom' ) return $content;
ob_start();
?>
<div class="bbc-custom-tab">
<h3><?php _e( 'Custom Tab', 'textdomain' ); ?></h3>
<p>Your custom content here.</p>
</div>
<?php
return ob_get_clean();
}, 10, 2 );
// Number of items per page (default: 10)
add_filter( 'baza_bc_account_bookings_per_page', function( $per_page ) {
return 20;
});
// Bookings data before sorting
add_filter( 'baza_bc_account_bookings_before_sort', function( $bookings ) {
return $bookings;
});
// Bookings data after sorting
add_filter( 'baza_bc_account_bookings_after_sort', function( $bookings, $orderby, $order ) {
return $bookings;
}, 10, 3 );
// Show/hide table count
add_filter( 'baza_bc_account_bookings_show_table_count', '__return_false' );
// Show/hide pagination
add_filter( 'baza_bc_account_bookings_show_pagination', '__return_false' );
// Show/hide entire table
add_filter( 'baza_bc_account_bookings_show_table', '__return_false' );
// Show/hide empty bookings message
add_filter( 'baza_bc_account_bookings_show_empty_message', '__return_false' );
// Pagination arguments
add_filter( 'baza_bc_account_bookings_pagination_args', function( $args ) {
return $args;
});
/**
* ACTIONS
*/
// Before content
add_action( 'baza_bc_dashboard_before_content', function( $user, $tab ) {
echo '<div class="content-header">Current tab: ' . $tab . '</div>';
}, 10, 2 );
// After content
add_action( 'baza_bc_dashboard_after_content', function( $user, $tab ) {
echo '<div class="content-footer">Need help? Contact support</div>';
}, 10, 2 );
// Before title
add_action( 'baza_bc_account_bookings_before_title', function() {
echo '<div class="custom-alert">Special announcement</div>';
});
// After title
add_action( 'baza_bc_account_bookings_after_title', function() {
echo '<p class="subtitle">Manage your bookings below</p>';
});
// Before controls (where sorting would go)
add_action( 'baza_bc_account_bookings_before_controls', function() {
echo '<div class="custom-filters">Custom filters here</div>';
});
// Inside table nav on the right side
add_action( 'baza_bc_account_bookings_table_nav_right', function( $orderby, $order, $per_page ) {
?>
<div class="bbc-table-sort">
<label for="bbc-sort"><?php _e( 'Sort:', 'baza-booking-calendar' ); ?></label>
<select id="bbc-sort" class="bbc-sort-select">
<option value="date-desc" <?php selected( $orderby === 'date' && $order === 'desc' ); ?>>
<?php _e( 'Newest First', 'baza-booking-calendar' ); ?>
</option>
<option value="date-asc" <?php selected( $orderby === 'date' && $order === 'asc' ); ?>>
<?php _e( 'Oldest First', 'baza-booking-calendar' ); ?>
</option>
<option value="price-desc" <?php selected( $orderby === 'price' && $order === 'desc' ); ?>>
<?php _e( 'Price: High to Low', 'baza-booking-calendar' ); ?>
</option>
<option value="price-asc" <?php selected( $orderby === 'price' && $order === 'asc' ); ?>>
<?php _e( 'Price: Low to High', 'baza-booking-calendar' ); ?>
</option>
</select>
</div>
<?php
}, 10, 3 );
// After controls
add_action( 'baza_bc_account_bookings_after_controls', function( $orderby, $order, $per_page ) {
echo '<div class="custom-notice">Current sort: ' . $orderby . '</div>';
}, 10, 3 );
// Before table
add_action( 'baza_bc_account_bookings_before_table', function( $bookings ) {
echo '<div class="table-info">Showing ' . count( $bookings ) . ' bookings</div>';
});
// Before each row
add_action( 'baza_bc_account_bookings_before_row', function( $booking ) {
// Add custom class or markup before row
});
// After each row
add_action( 'baza_bc_account_bookings_after_row', function( $booking ) {
// Add expandable details row
echo '<tr class="booking-details"><td colspan="5">Details for ' . $booking['order_id'] . '</td></tr>';
});
// After table
add_action( 'baza_bc_account_bookings_after_table', function( $bookings ) {
echo '<div class="table-summary">Total bookings: ' . count( $bookings ) . '</div>';
});
// Before pagination
add_action( 'baza_bc_account_bookings_before_pagination', function( $paged, $total_pages ) {
echo '<div class="pagination-info">Page ' . $paged . ' of ' . $total_pages . '</div>';
}, 10, 2 );
// After pagination
add_action( 'baza_bc_account_bookings_after_pagination', function( $paged, $total_pages ) {
echo '<a href="#top" class="back-to-top">Back to top</a>';
}, 10, 2 );
// After all content
add_action( 'baza_bc_account_bookings_after_content', function() {
echo '<div class="booking-help">Need help? Contact support</div>';
});
/**
* ACTIONS LOGIN AND REGISTER FORM
*/
/**
* LOGIN FORM HOOKS
*/
// Add content before login form
add_action( 'baza_bc_before_login_form', function( $atts ) {
echo '<div class="login-notice">Welcome back!</div>';
});
// Add content before form fields
add_action( 'baza_bc_before_login_form_fields', function( $atts ) {
echo '<p class="login-info">Please enter your credentials</p>';
});
// Add content after form fields
add_action( 'baza_bc_after_login_form_fields', function( $atts ) {
echo '<div class="social-login"><button>Login with Google</button></div>';
});
// Add content after login form
add_action( 'baza_bc_after_login_form', function( $atts ) {
echo '<p class="help-text">Need help? <a href="/support">Contact support</a></p>';
});
/**
* REGISTRATION FORM HOOKS
*/
// Add content before registration form
add_action( 'baza_bc_before_register_form', function( $atts ) {
echo '<div class="register-benefits">Join us and get 10% off!</div>';
});
// Add content after form opens
add_action( 'baza_bc_register_form_start', function( $atts ) {
echo '<p class="form-intro">Fill in all required fields</p>';
});
// Add phone field after email
add_action( 'baza_bc_register_form_after_email', function( $atts ) {
?>
<div class="form-row">
<label for="phone">Phone *</label>
<input type="tel" name="phone" id="phone" class="regular-text" placeholder="+44" required />
</div>
<?php
});
// Add hint after username
add_action( 'baza_bc_register_form_after_username', function( $atts ) {
echo '<small class="field-hint">Username cannot be changed later</small>';
});
// Add hint after password
add_action( 'baza_bc_register_form_after_password', function( $atts ) {
echo '<small class="field-hint">Password must be at least 8 characters</small>';
});
// Add hint after password confirm
add_action( 'baza_bc_register_form_after_password_confirm', function( $atts ) {
echo '<small class="field-hint">Passwords must match</small>';
});
// Add hint after first name
add_action( 'baza_bc_register_form_after_first_name', function( $atts ) {
echo '<small class="field-hint">Optional but recommended</small>';
});
// Add custom field after last name
add_action( 'baza_bc_register_form_after_last_name', function( $atts ) {
?>
<div class="form-row">
<label for="company">Company</label>
<input type="text" name="company" id="company" class="regular-text" placeholder="Your company name" />
</div>
<?php
});
// Add terms checkbox before submit button
add_action( 'baza_bc_register_form_before_submit', function( $atts ) {
?>
<div class="form-row">
<label>
<input type="checkbox" name="terms" required />
I agree to <a href="/terms">Terms and Conditions</a>
</label>
</div>
<?php
});
// Add content after submit button
add_action( 'baza_bc_register_form_after_submit', function( $atts ) {
echo '<p class="privacy-notice">Your data is protected by our privacy policy</p>';
});
// Add content after registration form
add_action( 'baza_bc_after_register_form', function( $atts ) {
echo '<div class="social-register"><button>Register with Facebook</button></div>';
});
/**
* TEXTS, REDIRECTS, SWITCHES
*/
// Text of the button of [baza_booking_calendar_auth] for a visitor and for a logged-in user
add_filter( 'baza_bc_auth_login_text', function( $text ) {
return __( 'Sign in', 'textdomain' );
});
add_filter( 'baza_bc_auth_account_text', function( $text ) {
return __( 'Account', 'textdomain' );
});
// Change the attributes of [baza_booking_calendar_auth] for every use
add_filter( 'baza_bc_auth_shortcode_atts', function( $atts ) {
return $atts;
});
// Where to go after logging out (default: home page)
add_filter( 'baza_bc_logout_redirect_url', function( $url ) {
return home_url( '/goodbye/' );
});
// Switch the whole auth module off
add_filter( 'baza_bc_auth_init', '__return_false' );
// Live updates of the bookings table in the account (default follows the calendar setting)
add_filter( 'baza_bc_account_live_updates', '__return_true' );
// How often the table asks for news, in seconds (never less than 5)
add_filter( 'baza_bc_account_live_updates_delay', function( $seconds ) {
return 30;
});
// May the client change a booking? ($can, $post_id, $meta - the booking data, $user_id)
// Default: true for a pending or booked booking that is not locked by its date
add_filter( 'baza_bc_client_can_edit_booking', function( $can, $post_id, $meta, $user_id ) {
return $can;
}, 10, 4 );
// May the client switch a booking to another service? ($can, $post_id, $user_id). Default: true
add_filter( 'baza_bc_client_can_change_service', function( $can, $post_id, $user_id ) {
return $can;
}, 10, 3 );
// May the client change the additional services of a booking? ($can, $post_id, $meta, $user_id)
// Default: true when the service has additional services
add_filter( 'baza_bc_client_can_edit_extras', function( $can, $post_id, $meta, $user_id ) {
return $can;
}, 10, 4 );
/**
* REGISTRATION
* The form creates the account with the WordPress function wp_create_user(), so the core hook user_register runs.
*/
// Save a custom field that was added with baza_bc_register_form_after_email
add_action( 'user_register', function( $user_id ) {
if ( isset( $_POST['phone'] ) ) {
update_user_meta( $user_id, 'phone', sanitize_text_field( wp_unslash( $_POST['phone'] ) ) );
}
});Приклади використання
<?php
// Example: put a banner above the content of every dashboard tab
add_action( 'baza_bc_dashboard_before_content', function( $user, $tab ) {
echo '<div class="notice">Hello, ' . esc_html( $user->display_name ) . '</div>';
}, 10, 2 );
// Example: add a tab and render it
add_filter( 'baza_bc_dashboard_tabs', function( $tabs, $current_tab ) {
$tabs['invoices'] = array(
'title' => __( 'Invoices', 'textdomain' ),
'url' => home_url( '/account/dashboard/invoices/' ),
'order' => 15,
);
return $tabs;
}, 10, 2 );
add_filter( 'baza_bc_dashboard_render_tab', function( $content, $tab ) {
return 'invoices' === $tab ? '<p>' . esc_html__( 'No invoices yet.', 'textdomain' ) . '</p>' : $content;
}, 10, 2 );
// Example: show only confirmed bookings, five per page
add_filter( 'baza_bc_account_bookings_per_page', function() { return 5; } );
add_filter( 'baza_bc_account_bookings_before_sort', function( $bookings ) {
return array_filter( $bookings, function( $booking ) {
return in_array( $booking['order_status'], array( 'booked', 'completed' ), true );
});
});
// Example: hide the table count and the pagination
add_filter( 'baza_bc_account_bookings_show_table_count', '__return_false' );
add_filter( 'baza_bc_account_bookings_show_pagination', '__return_false' );
// Example: a short text above the registration form fields and a terms checkbox before the button
add_action( 'baza_bc_register_form_start', function( $atts ) {
echo '<p class="form-intro">' . esc_html__( 'Fill in all required fields.', 'textdomain' ) . '</p>';
});
add_action( 'baza_bc_register_form_before_submit', function( $atts ) {
echo '<label><input type="checkbox" name="terms" required /> ' . esc_html__( 'I agree to the terms', 'textdomain' ) . '</label>';
});Вкладки кабінету
Вкладки за замовчуванням: Бронювання (порядок 10), Програма лояльності (20, лише коли функцію програм лояльності ввімкнено), Налаштування профілю (30) і Вихід (999). Модулі Balance, Packages і Referral додають власні вкладки, коли вони ввімкнені. Щоб додати, прибрати чи переставити вкладки, використовуйте baza_bc_dashboard_tabs.
