Specific Staff Shortcode

Complete

Use a shortcode to pre-choose a staff member, so the user won't have to choose a staff member.
Basically admin will be able to choose a staff member for the user.
Use cases: we can embed the shortcode in a staff member profile page.

For example: [bookingpress_form staff=1] [bookingpress_form staff=2] [bookingpress_form staff=3], etc...

Creosmart

1 year ago

Activity
Reputeinfosystems changed status to Complete

4 weeks ago

Igorimpavido

This feature would be incredibly useful for businesses that require consistent staff assignments. Having the ability to pre-select a staff member via shortcode would streamline the booking process and improve user experience. Hope this gets implemented soon!

0    1 month ago    Reply

Comment must be at least 20 characters.
Cancel

We love to listen to our customers.

Lorenzo Biroli

Yes, that would be great. We are developing a paltform that requires always the same staff member for the same customer, and currently that is not possible to do.

0    1 month ago    Reply

Comment must be at least 20 characters.
Cancel

We love to listen to our customers.

Niyaemilov

I've gone withh creating a small plugin for this (all reviews)

<?php
/*
Plugin Name: Staff Reviews
Description: Displays staff reviews in a grid layout with star ratings.
Version: 1.0
Author: Name
*/

// Prevent direct access
if (!defined('ABSPATH')) {
    exit;
}

// Define constants
define('STAFF_REVIEWS_LIMIT', 25); // Number of reviews to display
define('STAFF_REVIEWS_TABLE', 'bookingpress_staff_review'); // Database table name

// Enqueue CSS
function staff_reviews_enqueue_styles() {
    wp_enqueue_style(
        'staff-reviews-css',
        plugin_dir_url(__FILE__) . 'assets/css/staff-reviews.css',
        array(), // No dependencies
        filemtime(plugin_dir_path(__FILE__) . 'assets/css/staff-reviews.css') // Version based on file modification time
    );
}
add_action('wp_enqueue_scripts', 'staff_reviews_enqueue_styles');

// Shortcode function
function staff_reviews_shortcode() {
    global $wpdb;

    // Fetch reviews
    $table_name = $wpdb->prefix . STAFF_REVIEWS_TABLE;
    $reviews = $wpdb->get_results($wpdb->prepare("
        SELECT bookingpress_customer_name, review_rating, review_title, review_comment, updated_at
        FROM $table_name
        ORDER BY updated_at DESC
        LIMIT %d
    ", STAFF_REVIEWS_LIMIT));

    // Error handling
    if (is_wp_error($reviews)) {
        return '<p class="staff-reviews-error">Π“Ρ€Π΅ΡˆΠΊΠ° ΠΏΡ€ΠΈ Π·Π°Ρ€Π΅ΠΆΠ΄Π°Π½Π΅ Π½Π° Ρ€Π΅Π²ΡŽΡ‚Π°.</p>';
    }

    if (empty($reviews)) {
        return '<p class="staff-reviews-notice">Няма Π½Π°Π»ΠΈΡ‡Π½ΠΈ Ρ€Π΅Π²ΡŽΡ‚Π°.</p>';
    }

    // Build output
    $output = '<div class="staff-reviews-grid">';
    foreach ($reviews as $review) {
        $output .= '<div class="staff-review-card">';
        $output .= '<div class="staff-review-header">';
        $output .= '<h3 class="staff-review-author">' . esc_html($review->bookingpress_customer_name) . '</h3>';
        $output .= '<div class="staff-star-rating">';

        // Generate star rating
        $rating = intval($review->review_rating);
        for ($i = 1; $i <= 5; $i++) {
            $output .= $i <= $rating
                ? '<span class="staff-star filled">β˜…</span>'
                : '<span class="staff-star">β˜†</span>';
        }

        $output .= '</div></div>'; // Close star rating and header
        $output .= '<h4 class="staff-review-title">' . esc_html($review->review_title) . '</h4>';
        $output .= '<p class="staff-review-comment">' . esc_html($review->review_comment) . '</p>';
        $output .= '<time class="staff-review-date">' . esc_html(date('j/m/Y', strtotime($review->updated_at))) . '</time>';
        $output .= '</div>'; // Close review card
    }
    $output .= '</div>'; // Close grid

    return $output;
}
add_shortcode('staff_reviews', 'staff_reviews_shortcode');

1    2 months ago    Reply

Comment must be at least 20 characters.
Cancel

We love to listen to our customers.

Hamrahcare

It's very needed for services like therapy that the therapist doesn't change through the process.

1    3 months ago    Reply

Comment must be at least 20 characters.
Cancel

We love to listen to our customers.

Categories
πŸŽ‰ Feature