- Add interactive welcome guide modal with 4 informative cards - Implement cookie-based dismissal lasting 30 days - Create tooltips system for major sections across custom pages - Add comprehensive documentation page with FAQs and step-by-step guides - Include Font Awesome icons for visual enhancement - Add Help buttons to navigation across all pages - Enhance user onboarding and platform understanding 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
383 lines
No EOL
16 KiB
PHP
383 lines
No EOL
16 KiB
PHP
<?php
|
|
/**
|
|
* HVAC Help System
|
|
*
|
|
* Manages welcome guide, tooltips, and documentation for the HVAC Community Events plugin
|
|
*/
|
|
|
|
class HVAC_Help_System {
|
|
|
|
private static $instance = null;
|
|
|
|
public static function instance() {
|
|
if (null === self::$instance) {
|
|
self::$instance = new self();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
private function __construct() {
|
|
add_action('wp_enqueue_scripts', array($this, 'enqueue_help_assets'));
|
|
add_action('wp_footer', array($this, 'render_welcome_guide'));
|
|
add_shortcode('hvac_documentation', array($this, 'render_documentation_page'));
|
|
add_action('wp_ajax_hvac_dismiss_welcome', array($this, 'handle_welcome_dismissal'));
|
|
add_action('wp_ajax_nopriv_hvac_dismiss_welcome', array($this, 'handle_welcome_dismissal'));
|
|
}
|
|
|
|
/**
|
|
* Enqueue help system assets
|
|
*/
|
|
public function enqueue_help_assets() {
|
|
// Only load on HVAC pages for authenticated trainers
|
|
if (!$this->is_hvac_page() || !$this->is_trainer_logged_in()) {
|
|
return;
|
|
}
|
|
|
|
// Enqueue Font Awesome for icons
|
|
wp_enqueue_style(
|
|
'font-awesome',
|
|
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css',
|
|
array(),
|
|
'6.0.0'
|
|
);
|
|
|
|
wp_enqueue_style(
|
|
'hvac-help-system',
|
|
HVAC_CE_PLUGIN_URL . 'assets/css/hvac-help-system.css',
|
|
array('hvac-common-style', 'font-awesome'),
|
|
HVAC_CE_VERSION
|
|
);
|
|
|
|
wp_enqueue_script(
|
|
'hvac-help-system',
|
|
HVAC_CE_PLUGIN_URL . 'assets/js/hvac-help-system.js',
|
|
array('jquery'),
|
|
HVAC_CE_VERSION,
|
|
true
|
|
);
|
|
|
|
wp_localize_script('hvac-help-system', 'hvacHelp', array(
|
|
'ajaxUrl' => admin_url('admin-ajax.php'),
|
|
'nonce' => wp_create_nonce('hvac_help_nonce'),
|
|
'showWelcome' => $this->should_show_welcome_guide()
|
|
));
|
|
}
|
|
|
|
/**
|
|
* Check if current page is an HVAC custom page
|
|
*/
|
|
private function is_hvac_page() {
|
|
$hvac_pages = array(
|
|
'hvac-dashboard', 'trainer-registration', 'community-login',
|
|
'trainer-profile', 'event-summary', 'email-attendees',
|
|
'certificate-reports', 'generate-certificates', 'hvac-documentation'
|
|
);
|
|
|
|
foreach ($hvac_pages as $page) {
|
|
if (is_page($page)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Check if current user is a logged-in trainer
|
|
*/
|
|
private function is_trainer_logged_in() {
|
|
return is_user_logged_in() && (current_user_can('hvac_trainer') || current_user_can('administrator'));
|
|
}
|
|
|
|
/**
|
|
* Check if welcome guide should be shown
|
|
*/
|
|
private function should_show_welcome_guide() {
|
|
if (!$this->is_trainer_logged_in()) {
|
|
return false;
|
|
}
|
|
|
|
// Check cookie for dismissal
|
|
if (isset($_COOKIE['hvac_welcome_dismissed'])) {
|
|
return false;
|
|
}
|
|
|
|
// Only show on dashboard page
|
|
return is_page('hvac-dashboard');
|
|
}
|
|
|
|
/**
|
|
* Render welcome guide modal
|
|
*/
|
|
public function render_welcome_guide() {
|
|
if (!$this->should_show_welcome_guide()) {
|
|
return;
|
|
}
|
|
|
|
$cards = $this->get_welcome_cards();
|
|
?>
|
|
<div id="hvac-welcome-modal" class="hvac-modal-overlay">
|
|
<div class="hvac-modal-content">
|
|
<div class="hvac-modal-header">
|
|
<h2>Welcome to Upskill HVAC Training Network!</h2>
|
|
<button class="hvac-modal-close" aria-label="Close welcome guide">×</button>
|
|
</div>
|
|
|
|
<div class="hvac-welcome-cards">
|
|
<?php foreach ($cards as $index => $card): ?>
|
|
<div class="hvac-welcome-card <?php echo $index === 0 ? 'active' : 'hidden'; ?>" data-card="<?php echo $index; ?>">
|
|
<div class="hvac-card-icon">
|
|
<i class="<?php echo esc_attr($card['icon']); ?>"></i>
|
|
</div>
|
|
<div class="hvac-card-content">
|
|
<h3><?php echo esc_html($card['title']); ?></h3>
|
|
<p><?php echo esc_html($card['description']); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<div class="hvac-modal-navigation">
|
|
<button id="hvac-prev-card" class="hvac-nav-btn" disabled>Previous</button>
|
|
<div class="hvac-card-indicators">
|
|
<?php for ($i = 0; $i < count($cards); $i++): ?>
|
|
<span class="hvac-indicator <?php echo $i === 0 ? 'active' : ''; ?>" data-card="<?php echo $i; ?>"></span>
|
|
<?php endfor; ?>
|
|
</div>
|
|
<button id="hvac-next-card" class="hvac-nav-btn">Next</button>
|
|
</div>
|
|
|
|
<div class="hvac-modal-footer">
|
|
<label class="hvac-dismiss-checkbox">
|
|
<input type="checkbox" id="hvac-dont-show-again"> Don't show this again
|
|
</label>
|
|
<button id="hvac-get-started" class="hvac-primary-btn">Get Started</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
|
|
/**
|
|
* Get welcome guide cards data
|
|
*/
|
|
private function get_welcome_cards() {
|
|
return array(
|
|
array(
|
|
'icon' => 'fas fa-chalkboard-teacher',
|
|
'title' => 'Verified Expert Platform',
|
|
'description' => 'You\'re part of our vetted community of HVAC training experts. Our screening process ensures only qualified professionals can host events on the platform.'
|
|
),
|
|
array(
|
|
'icon' => 'fas fa-calendar-plus',
|
|
'title' => 'Create & Manage Events',
|
|
'description' => 'Easily create training events, set pricing, and manage registrations. All events are reviewed by our in-house trainers before publishing to ensure quality.'
|
|
),
|
|
array(
|
|
'icon' => 'fas fa-dollar-sign',
|
|
'title' => 'Keep 100% Revenue',
|
|
'description' => 'You keep 100% of your ticket sales (minus standard Stripe processing fees). Track your earnings and progress toward your revenue goals right from your dashboard.'
|
|
),
|
|
array(
|
|
'icon' => 'fas fa-certificate',
|
|
'title' => 'Professional Certificates',
|
|
'description' => 'Generate and send professional certificates of completion to your attendees. Build your reputation and provide value that keeps trainees coming back.'
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Handle AJAX request to dismiss welcome guide
|
|
*/
|
|
public function handle_welcome_dismissal() {
|
|
if (!wp_verify_nonce($_POST['nonce'], 'hvac_help_nonce')) {
|
|
wp_die('Invalid nonce');
|
|
}
|
|
|
|
if (!$this->is_trainer_logged_in()) {
|
|
wp_die('Unauthorized');
|
|
}
|
|
|
|
// Set cookie to expire in 30 days
|
|
setcookie('hvac_welcome_dismissed', '1', time() + (30 * 24 * 60 * 60), COOKIEPATH, COOKIE_DOMAIN);
|
|
|
|
wp_send_json_success();
|
|
}
|
|
|
|
/**
|
|
* Render documentation page content
|
|
*/
|
|
public function render_documentation_page($atts) {
|
|
if (!$this->is_trainer_logged_in()) {
|
|
return '<p>Please log in to access the documentation.</p>';
|
|
}
|
|
|
|
ob_start();
|
|
?>
|
|
<div class="hvac-documentation">
|
|
<div class="hvac-doc-header">
|
|
<h1>Trainer Documentation</h1>
|
|
<p class="hvac-doc-subtitle">Everything you need to know about managing your training events</p>
|
|
</div>
|
|
|
|
<div class="hvac-doc-navigation">
|
|
<ul class="hvac-doc-nav">
|
|
<li><a href="#getting-started" class="hvac-doc-link">Getting Started</a></li>
|
|
<li><a href="#managing-events" class="hvac-doc-link">Managing Events</a></li>
|
|
<li><a href="#attendee-management" class="hvac-doc-link">Attendee Management</a></li>
|
|
<li><a href="#certificates" class="hvac-doc-link">Certificates</a></li>
|
|
<li><a href="#faq" class="hvac-doc-link">FAQ</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="hvac-doc-content">
|
|
<?php echo $this->get_documentation_content(); ?>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
return ob_get_clean();
|
|
}
|
|
|
|
/**
|
|
* Get main documentation content
|
|
*/
|
|
private function get_documentation_content() {
|
|
return '
|
|
<section id="getting-started" class="hvac-doc-section">
|
|
<h2><i class="fas fa-play-circle"></i> Getting Started</h2>
|
|
<div class="hvac-doc-grid">
|
|
<div class="hvac-doc-card">
|
|
<h3>1. Complete Your Profile</h3>
|
|
<p>Update your trainer profile with your credentials, business information, and training specialties. This helps trainees find and trust your expertise.</p>
|
|
<a href="/trainer-profile" class="hvac-doc-btn">Edit Profile</a>
|
|
</div>
|
|
<div class="hvac-doc-card">
|
|
<h3>2. Create Your First Event</h3>
|
|
<p>Use our event creation form to set up your training. Include detailed descriptions, pricing, and capacity limits.</p>
|
|
<a href="/manage-event" class="hvac-doc-btn">Create Event</a>
|
|
</div>
|
|
<div class="hvac-doc-card">
|
|
<h3>3. Monitor Your Dashboard</h3>
|
|
<p>Track your events, revenue, and performance metrics from your centralized dashboard.</p>
|
|
<a href="/hvac-dashboard" class="hvac-doc-btn">View Dashboard</a>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="managing-events" class="hvac-doc-section">
|
|
<h2><i class="fas fa-calendar-alt"></i> Managing Events</h2>
|
|
<div class="hvac-feature-list">
|
|
<div class="hvac-feature">
|
|
<h3>Event Creation Process</h3>
|
|
<ol>
|
|
<li><strong>Draft:</strong> Create your event with all details</li>
|
|
<li><strong>Review:</strong> Our team reviews for quality and compliance</li>
|
|
<li><strong>Published:</strong> Event goes live for registration</li>
|
|
</ol>
|
|
</div>
|
|
<div class="hvac-feature">
|
|
<h3>Key Event Features</h3>
|
|
<ul>
|
|
<li>Multiple ticket types and pricing tiers</li>
|
|
<li>Capacity management and waitlists</li>
|
|
<li>Custom registration fields</li>
|
|
<li>Automated confirmation emails</li>
|
|
</ul>
|
|
</div>
|
|
<div class="hvac-feature">
|
|
<h3>Event Summary Page</h3>
|
|
<p>Access detailed event information including attendee lists, sales data, and check-in capabilities. Each event has its own summary page accessible from your dashboard.</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="attendee-management" class="hvac-doc-section">
|
|
<h2><i class="fas fa-users"></i> Attendee Management</h2>
|
|
<div class="hvac-feature-list">
|
|
<div class="hvac-feature">
|
|
<h3>Registration Tracking</h3>
|
|
<p>View all registrations, payment status, and attendee information from your event summary page. Export attendee lists for your records.</p>
|
|
</div>
|
|
<div class="hvac-feature">
|
|
<h3>Communication Tools</h3>
|
|
<p>Send emails to all attendees or specific groups. Use our email templates or create custom messages for updates and reminders.</p>
|
|
</div>
|
|
<div class="hvac-feature">
|
|
<h3>Check-in System</h3>
|
|
<p>Mark attendees as present during your event. This data is used for certificate generation and completion tracking.</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="certificates" class="hvac-doc-section">
|
|
<h2><i class="fas fa-certificate"></i> Professional Certificates</h2>
|
|
<div class="hvac-feature-list">
|
|
<div class="hvac-feature">
|
|
<h3>Certificate Generation</h3>
|
|
<p>Create professional certificates for attendees who completed your training. Certificates include event details, your signature, and completion date.</p>
|
|
</div>
|
|
<div class="hvac-feature">
|
|
<h3>Distribution Options</h3>
|
|
<ul>
|
|
<li>Email directly to attendees</li>
|
|
<li>Download PDF files for printing</li>
|
|
<li>Bulk generation for multiple attendees</li>
|
|
</ul>
|
|
</div>
|
|
<div class="hvac-feature">
|
|
<h3>Certificate Management</h3>
|
|
<p>Track which certificates have been issued and manage your certificate templates from the Certificate Reports page.</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="faq" class="hvac-doc-section">
|
|
<h2><i class="fas fa-question-circle"></i> Frequently Asked Questions</h2>
|
|
<div class="hvac-faq-list">
|
|
<div class="hvac-faq-item">
|
|
<h3>How do I get paid for my events?</h3>
|
|
<p>Payments are processed through Stripe and deposited directly to your account. You keep 100% of ticket sales minus standard Stripe processing fees (typically 2.9% + 30¢ per transaction).</p>
|
|
</div>
|
|
<div class="hvac-faq-item">
|
|
<h3>How long does event review take?</h3>
|
|
<p>Our review process typically takes 1-2 business days. We check for content quality, appropriate pricing, and compliance with industry standards.</p>
|
|
</div>
|
|
<div class="hvac-faq-item">
|
|
<h3>Can I modify events after they\'re published?</h3>
|
|
<p>Yes, you can edit event details, but significant changes may require re-review. We recommend finalizing details before initial submission.</p>
|
|
</div>
|
|
<div class="hvac-faq-item">
|
|
<h3>What if I need to cancel an event?</h3>
|
|
<p>Contact our support team immediately. We\'ll help you manage refunds and communicate with registered attendees.</p>
|
|
</div>
|
|
<div class="hvac-faq-item">
|
|
<h3>How do I improve my event visibility?</h3>
|
|
<p>Complete your profile thoroughly, use detailed event descriptions, competitive pricing, and maintain high attendance rates. Quality events get featured prominently.</p>
|
|
</div>
|
|
<div class="hvac-faq-item">
|
|
<h3>Can I offer different types of training?</h3>
|
|
<p>Yes! You can offer in-person, virtual, hybrid, and on-demand training formats. Set your preferred training locations and formats in your profile.</p>
|
|
</div>
|
|
<div class="hvac-faq-item">
|
|
<h3>What support is available?</h3>
|
|
<p>Access this documentation anytime, use the help tooltips throughout the platform, or contact our support team for personalized assistance.</p>
|
|
</div>
|
|
</div>
|
|
</section>';
|
|
}
|
|
|
|
/**
|
|
* Add tooltip data attribute to elements
|
|
*/
|
|
public static function add_tooltip($content, $tooltip_text, $position = 'top') {
|
|
return sprintf(
|
|
'<span class="hvac-tooltip-wrapper" data-tooltip="%s" data-position="%s">%s</span>',
|
|
esc_attr($tooltip_text),
|
|
esc_attr($position),
|
|
$content
|
|
);
|
|
}
|
|
}
|
|
|
|
// Initialize the help system
|
|
HVAC_Help_System::instance();
|