diff --git a/wordpress-dev/bin/verify-dashboard.sh b/wordpress-dev/bin/verify-dashboard.sh
new file mode 100755
index 00000000..0bb4f57a
--- /dev/null
+++ b/wordpress-dev/bin/verify-dashboard.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Verify dashboard changes by running Playwright script
+# Usage: ./verify-dashboard.sh
+
+cd "$(dirname "$0")/.."
+
+# Check if Node.js is installed
+if ! command -v node &> /dev/null; then
+ echo "Node.js is required to run this script"
+ exit 1
+fi
+
+# Check if Playwright is installed
+if ! npm list -g playwright &> /dev/null; then
+ echo "Installing Playwright..."
+ npm install -g playwright
+fi
+
+# Run the verification script
+echo "Running dashboard verification script..."
+node bin/verify-dashboard-changes.js
+
+echo "Verification complete. Check the generated screenshots for visual confirmation."
\ No newline at end of file
diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/create-trainer-profile-page.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/create-trainer-profile-page.php
new file mode 100644
index 00000000..0acb3bc0
--- /dev/null
+++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/create-trainer-profile-page.php
@@ -0,0 +1,69 @@
+ 'Trainer Profile',
+ 'post_name' => 'trainer-profile',
+ 'post_content' => '[hvac_trainer_profile]',
+ 'post_status' => 'publish',
+ 'post_type' => 'page',
+ 'comment_status' => 'closed',
+ 'ping_status' => 'closed',
+];
+
+if (!$existing_page) {
+ // Create new page
+ $page_id = wp_insert_post($page_data);
+ if (is_wp_error($page_id)) {
+ echo "Error creating trainer-profile page: " . $page_id->get_error_message() . "\n";
+ } else {
+ echo "Successfully created trainer-profile page with ID: $page_id\n";
+
+ // Update the HVAC community pages option
+ $created_pages_option = 'hvac_community_pages';
+ $created_pages = get_option($created_pages_option, []);
+ $created_pages['trainer_profile'] = $page_id;
+ update_option($created_pages_option, $created_pages);
+ echo "Updated hvac_community_pages option with the new page ID\n";
+ }
+} else {
+ // Update existing page
+ $page_data['ID'] = $existing_page->ID;
+ $page_id = wp_update_post($page_data);
+
+ if (is_wp_error($page_id)) {
+ echo "Error updating trainer-profile page: " . $page_id->get_error_message() . "\n";
+ } else {
+ echo "Successfully updated trainer-profile page with ID: $page_id\n";
+
+ // Ensure the page is in the HVAC community pages option
+ $created_pages_option = 'hvac_community_pages';
+ $created_pages = get_option($created_pages_option, []);
+ if (!isset($created_pages['trainer_profile']) || $created_pages['trainer_profile'] != $page_id) {
+ $created_pages['trainer_profile'] = $page_id;
+ update_option($created_pages_option, $created_pages);
+ echo "Updated hvac_community_pages option with the page ID\n";
+ }
+ }
+}
+
+// Flush rewrite rules to ensure the page is accessible
+flush_rewrite_rules();
+echo "Flushed rewrite rules\n";
+
+echo "Done!\n";
\ No newline at end of file
diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/hvac-community-events.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/hvac-community-events.php
index d34090a5..917ecb9d 100644
--- a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/hvac-community-events.php
+++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/hvac-community-events.php
@@ -55,6 +55,10 @@ function hvac_ce_create_required_pages() {
'title' => 'My Events',
'content' => '[tribe_community_events view="my_events"]',
],
+ 'trainer-profile' => [ // Add trainer profile page
+ 'title' => 'Trainer Profile',
+ 'content' => '[hvac_trainer_profile]',
+ ],
// REMOVED: 'submit-event' page creation. Will link to default TEC CE page.
// 'submit-event' => [
// 'title' => 'Submit Event',
diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php
index 3e9b8992..46404001 100644
--- a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php
+++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/class-hvac-community-events.php
@@ -205,8 +205,8 @@ class HVAC_Community_Events {
// Registration form shortcode
add_shortcode('hvac_trainer_registration', array('HVAC_Registration', 'render_registration_form'));
- // Community login shortcode
- add_shortcode('hvac_community_login', array('\\HVAC_Community_Events\\Community\\Login_Handler', 'render_login_form'));
+ // Community login shortcode - initialize Login_Handler to register the shortcode
+ new \HVAC_Community_Events\Community\Login_Handler();
// Dashboard shortcode
add_shortcode('hvac_dashboard', array($this, 'render_dashboard'));
@@ -214,6 +214,9 @@ class HVAC_Community_Events {
// Add the event summary shortcode
add_shortcode('hvac_event_summary', array($this, 'render_event_summary'));
+ // Add trainer profile shortcode
+ add_shortcode('hvac_trainer_profile', array($this, 'render_trainer_profile'));
+
// Remove the event form shortcode as we're using TEC's shortcode instead
// add_shortcode('hvac_event_form', array('HVAC_Community_Event_Handler', 'render_event_form'));
@@ -241,6 +244,20 @@ class HVAC_Community_Events {
// This can be used to display custom event summary content
return '
Event Summary Content Here
';
}
+
+ /**
+ * Render trainer profile content
+ */
+ public function render_trainer_profile() {
+ if (!is_user_logged_in()) {
+ return 'Please log in to view your profile.
';
+ }
+
+ // Include the trainer profile template
+ ob_start();
+ include HVAC_CE_PLUGIN_DIR . 'templates/template-trainer-profile.php';
+ return ob_get_clean();
+ }
/**
* Include custom templates for plugin pages
@@ -269,6 +286,14 @@ class HVAC_Community_Events {
return $custom_template;
}
}
+
+ // Check for trainer-profile page
+ if (is_page('trainer-profile')) {
+ $custom_template = HVAC_CE_PLUGIN_DIR . 'templates/template-trainer-profile.php';
+ if (file_exists($custom_template)) {
+ return $custom_template;
+ }
+ }
// Check for single event view (temporary)
if ( is_singular( 'tribe_events' ) ) {
diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/community/class-login-handler.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/community/class-login-handler.php
index bbad0a9c..9285b689 100644
--- a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/community/class-login-handler.php
+++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/community/class-login-handler.php
@@ -23,18 +23,22 @@ class Login_Handler {
* Hooks into WordPress.
*/
public function __construct() {
- add_shortcode( 'hvac_community_login', array( $this, 'render_login_form' ) );
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue scripts/styles
+ // Register our shortcode only if it doesn't exist already
+ if (!shortcode_exists('hvac_community_login')) {
+ add_shortcode('hvac_community_login', array($this, 'render_login_form'));
+ }
+
+ add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); // Enqueue scripts/styles
// Add action hooks for authentication and redirection (Task 2.2 & 2.5)
- add_action( 'wp_authenticate', array( $this, 'handle_authentication' ), 30, 2 ); // Allow custom auth checks
- // REMOVED: add_action( 'login_form_login', array( $this, 'redirect_on_login_failure' ) ); // This was causing premature redirects
+ add_action('wp_authenticate', array($this, 'handle_authentication'), 30, 2); // Allow custom auth checks
+ // REMOVED: add_action('login_form_login', array($this, 'redirect_on_login_failure')); // This was causing premature redirects
- add_action( 'wp_login_failed', array( $this, 'handle_login_failure' ) ); // Handle failed login redirect
- add_filter( 'login_redirect', array( $this, 'custom_login_redirect' ), 10, 3 ); // Handle success redirect
+ add_action('wp_login_failed', array($this, 'handle_login_failure')); // Handle failed login redirect
+ add_filter('login_redirect', array($this, 'custom_login_redirect'), 10, 3); // Handle success redirect
// Redirect logged-in users away from the login page
- add_action( 'template_redirect', array( $this, 'redirect_logged_in_user' ) );
+ add_action('template_redirect', array($this, 'redirect_logged_in_user'));
}
/**
diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/template-trainer-profile.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/template-trainer-profile.php
new file mode 100644
index 00000000..5d200c60
--- /dev/null
+++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/templates/template-trainer-profile.php
@@ -0,0 +1,450 @@
+ get_user_meta($user_id, 'personal_accreditation', true),
+ 'business_name' => get_user_meta($user_id, 'business_name', true),
+ 'business_phone' => get_user_meta($user_id, 'business_phone', true),
+ 'business_email' => get_user_meta($user_id, 'business_email', true),
+ 'business_website' => get_user_meta($user_id, 'business_website', true),
+ 'business_description' => get_user_meta($user_id, 'business_description', true),
+ 'user_country' => get_user_meta($user_id, 'user_country', true),
+ 'user_state' => get_user_meta($user_id, 'user_state', true),
+ 'user_city' => get_user_meta($user_id, 'user_city', true),
+ 'user_zip' => get_user_meta($user_id, 'user_zip', true),
+ 'linkedin' => get_user_meta($user_id, 'user_linkedin', true),
+ 'business_type' => get_user_meta($user_id, 'business_type', true),
+ 'training_audience' => get_user_meta($user_id, 'training_audience', true),
+ 'training_formats' => get_user_meta($user_id, 'training_formats', true),
+ 'training_locations' => get_user_meta($user_id, 'training_locations', true),
+ 'training_resources' => get_user_meta($user_id, 'training_resources', true),
+ 'annual_revenue_target' => get_user_meta($user_id, 'annual_revenue_target', true),
+);
+
+// Get organizer ID if available
+$organizer_id = get_user_meta($user_id, 'hvac_organizer_id', true);
+
+// Get venue ID if available
+$venue_id = get_user_meta($user_id, 'hvac_venue_id', true);
+
+// Get training stats
+include_once HVAC_CE_PLUGIN_DIR . 'includes/class-hvac-dashboard-data.php';
+$dashboard_data = new HVAC_Dashboard_Data($user_id);
+$total_events = $dashboard_data->get_total_events_count();
+$upcoming_events = $dashboard_data->get_upcoming_events_count();
+$past_events = $dashboard_data->get_past_events_count();
+$total_sold = $dashboard_data->get_total_tickets_sold();
+$total_revenue = $dashboard_data->get_total_revenue();
+
+// --- Template Start ---
+get_header(); // Use theme's header
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
; ?>)
+
+
+ first_name, 0, 1) . substr($user->last_name, 0, 1)); ?>
+
+
+
+
+
+
display_name); ?>
+
+
+
+
+
+
description); ?>
+
+
+
+
+
+
+
+
+ Business Information
+
+
+
+
+
Type:
+
Phone:
+
Email:
+
+
+
Website:
+
+
+
+
Address
+
+ ,
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Training Information
+
+
+
+
+
+
Training Audience
+
+
+
+
No training audience specified
+
+
+
+
+
+
Training Formats
+
+
+
+
No training formats specified
+
+
+
+
+
+
Training Locations
+
+
+
+
No training locations specified
+
+
+
+
+
+
Training Resources
+
+
+
+
No training resources specified
+
+
+
+
+
+
+
+
+ Training Statistics
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Total Revenue
+
$
+
+
Target: $
+
+
+
+
+
+
+
+
+
+
+
+
+
+