✅ Fixed the core issue - plugin now automatically creates pages on activation ## Changes Made - Updated HVAC_Announcements_Manager::activate() to create all required pages - Fixed duplicate method issue by removing instance methods - Added page creation to HVAC_Activator::activate() hook - Added deactivation cleanup to HVAC_Deactivator::deactivate() ## Pages Auto-Created - /master-trainer/manage-announcements/ (with [hvac_announcements_manager]) - /trainer/announcements/ (with [hvac_announcements_timeline]) - /trainer/training-resources/ (with Google Drive embed) ## Verification ✅ All pages now exist and load successfully ✅ Shortcodes are properly displayed ✅ Components are loading (timeline, iframe) ✅ No more manual page creation required Plugin activation now handles complete announcements system setup automatically. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			62 lines
		
	
	
		
			No EOL
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			No EOL
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Plugin Deactivator for HVAC Community Events
 | |
|  *
 | |
|  * Handles plugin deactivation tasks
 | |
|  *
 | |
|  * @package HVAC_Community_Events
 | |
|  * @since 1.0.0
 | |
|  */
 | |
| 
 | |
| if (!defined('ABSPATH')) {
 | |
|     exit;
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * HVAC_Deactivator class
 | |
|  */
 | |
| class HVAC_Deactivator {
 | |
|     
 | |
|     /**
 | |
|      * Deactivate the plugin
 | |
|      * 
 | |
|      * @return void
 | |
|      */
 | |
|     public static function deactivate() {
 | |
|         HVAC_Logger::info('Starting plugin deactivation', 'Deactivator');
 | |
|         
 | |
|         // Clear scheduled cron jobs
 | |
|         self::clear_cron_jobs();
 | |
|         
 | |
|         // Deactivate announcements system
 | |
|         if (class_exists('HVAC_Announcements_Manager')) {
 | |
|             HVAC_Announcements_Manager::deactivate();
 | |
|         }
 | |
|         
 | |
|         // Flush rewrite rules
 | |
|         flush_rewrite_rules();
 | |
|         
 | |
|         HVAC_Logger::info('Plugin deactivation completed', 'Deactivator');
 | |
|     }
 | |
|     
 | |
|     /**
 | |
|      * Clear scheduled cron jobs
 | |
|      * 
 | |
|      * @return void
 | |
|      */
 | |
|     private static function clear_cron_jobs() {
 | |
|         // Clear daily trainer status check
 | |
|         $timestamp = wp_next_scheduled('hvac_daily_trainer_status_check');
 | |
|         if ($timestamp) {
 | |
|             wp_unschedule_event($timestamp, 'hvac_daily_trainer_status_check');
 | |
|             HVAC_Logger::info('Cleared daily trainer status check cron', 'Deactivator');
 | |
|         }
 | |
|         
 | |
|         // Clear weekly cleanup
 | |
|         $timestamp = wp_next_scheduled('hvac_weekly_cleanup');
 | |
|         if ($timestamp) {
 | |
|             wp_unschedule_event($timestamp, 'hvac_weekly_cleanup');
 | |
|             HVAC_Logger::info('Cleared weekly cleanup cron', 'Deactivator');
 | |
|         }
 | |
|     }
 | |
| } |