# HVAC Trainer Import Instructions ## Overview This guide walks you through importing trainer data from the Formidable Forms CSV export into your WordPress database. ## Files Created 1. `admin-import-trainers.php` - Web-based import tool for server execution 2. `scripts/import-trainer-csv.php` - Command-line import script (if server has CLI access) 3. `scripts/README-import.md` - Detailed technical documentation ## 🚨 IMPORTANT SECURITY NOTES - **Remove `admin-import-trainers.php` immediately after import** - Only run this on production with admin access - Always backup your database first ## Method 1: Web-Based Import (Recommended) ### Step 1: Deploy to Server 1. Upload `admin-import-trainers.php` to your WordPress root directory 2. Ensure you have WordPress admin access ### Step 2: Download CSV File Download the trainer data CSV: ``` https://upskill-staging.measurequick.com/wp-content/uploads/2025/06/250618120131_user-registration_formidable_entries.csv ``` ### Step 3: Access Import Tool Visit: `https://yoursite.com/admin-import-trainers.php` ### Step 4: Run Import 1. **First**: Upload CSV and check "Dry Run" to preview changes 2. **Review**: Check the dry-run output for any issues 3. **Import**: Uncheck "Dry Run" and run actual import 4. **Verify**: Check that users were created correctly ### Step 5: Cleanup **IMMEDIATELY** delete `admin-import-trainers.php` from your server for security! ## Method 2: Command Line (If Available) If your server has SSH/CLI access: ```bash # Upload script to server scp scripts/import-trainer-csv.php user@yourserver:/path/to/wordpress/ # Download CSV curl -O "https://upskill-staging.measurequick.com/wp-content/uploads/2025/06/250618120131_user-registration_formidable_entries.csv" # Run dry-run php import-trainer-csv.php 250618120131_user-registration_formidable_entries.csv --dry-run # Run actual import php import-trainer-csv.php 250618120131_user-registration_formidable_entries.csv ``` ## What Gets Imported ### User Data - Creates WordPress users with `hvac_trainer` role - Maps personal and business information to user meta - Sets all imported users as `approved` (pre-approved) - Generates secure passwords and sends welcome emails ### Field Mappings | CSV Field | WordPress Field | Notes | |-----------|----------------|-------| | Name/Last Name | first_name, last_name | User profile | | Work Email | user_email, user_login | Primary identifier | | Company Name | business_name | Business info | | Phone Number | business_phone | Contact info | | Personal Accreditations | personal_accreditation | Certifications | | Training Target | training_audience | Converted to array | | Profile Picture | profile_image_id | URL mapped to attachment | ### Events Calendar Integration - Creates organizer profiles for each trainer - Creates venue profiles for businesses - Links profiles to user accounts ## Image Handling - **No image downloads** - assumes images exist on current server - Maps staging URLs to production URLs automatically - Logs warnings for missing images ## Verification Steps After import, verify: 1. **User Creation**: Check Users → All Users in WordPress admin 2. **Role Assignment**: Ensure users have `hvac_trainer` role 3. **Meta Data**: Check user profiles for complete information 4. **Email Delivery**: Confirm welcome emails were sent 5. **Events Integration**: Verify organizer/venue profiles created ## Troubleshooting ### Common Issues - **Missing images**: Check if profile images exist on your server - **Duplicate emails**: Script handles duplicates by updating existing users - **Role errors**: Ensure `hvac_trainer` role exists in your system - **Email failures**: Check WordPress mail configuration ### Support - Check `scripts/README-import.md` for detailed technical info - Review error messages in import output - Verify WordPress permissions and plugins ## Sample Output ``` Starting import from uploaded CSV DRY RUN MODE - No data will be modified ---------------------------------------- Creating new user: trainer1@example.com Creating new user: trainer2@example.com Warning: Could not find attachment for URL: https://... ======================================== Import Complete! ======================================== Processed: 25 Created: 23 Updated: 2 Skipped: 0 Errors: 0 ``` ## Post-Import Tasks 1. **Remove import files** for security 2. **Test user logins** with password reset 3. **Verify trainer dashboards** work correctly 4. **Check event creation** permissions 5. **Update documentation** with new user count