diff --git a/wordpress-dev/bin/clear-certificate-test-data.sh b/wordpress-dev/bin/clear-certificate-test-data.sh new file mode 100755 index 00000000..fc3cce32 --- /dev/null +++ b/wordpress-dev/bin/clear-certificate-test-data.sh @@ -0,0 +1,139 @@ +#!/bin/bash + +# Script to clear certificate test data on staging server +# This script should be run on the staging server + +echo "=== Certificate Test Data Cleanup Script ===" +echo "This script will clear certificate test data from the staging server." +echo "" + +# Check if wp-cli is available +if ! command -v wp &> /dev/null; then + echo "Error: wp-cli is not installed or not in PATH" + exit 1 +fi + +# Navigate to WordPress directory +cd /home/uberrxmprk/cloudwaysapps.com/rfymqitokx/public_html + +echo "1. Checking current certificate count..." +CERT_COUNT=$(wp db query "SELECT COUNT(*) FROM wp_hvac_certificates" --skip-column-names 2>/dev/null || echo "0") +echo " Found $CERT_COUNT certificates in database" + +echo "" +echo "2. Checking certificate files..." +CERT_DIR="/home/uberrxmprk/cloudwaysapps.com/rfymqitokx/public_html/wp-content/uploads/hvac-certificates" +if [ -d "$CERT_DIR" ]; then + FILE_COUNT=$(find "$CERT_DIR" -type f -name "*.pdf" 2>/dev/null | wc -l) + echo " Found $FILE_COUNT PDF files in certificate directory" +else + echo " Certificate directory not found" + FILE_COUNT=0 +fi + +echo "" +echo "What would you like to do?" +echo "1) Clear ALL certificates (database and files)" +echo "2) Clear only TEST certificates (generated by test_trainer)" +echo "3) Clear only certificate FILES (keep database records)" +echo "4) Clear only certificate DATABASE records (keep files)" +echo "5) Exit without changes" +echo "" +read -p "Enter your choice (1-5): " choice + +case $choice in + 1) + echo "" + echo "Clearing ALL certificates..." + + # Clear database + wp db query "TRUNCATE TABLE wp_hvac_certificates" + echo "✓ Database cleared" + + # Clear files + if [ -d "$CERT_DIR" ]; then + rm -rf "$CERT_DIR"/* + echo "✓ Certificate files cleared" + fi + + # Clear any certificate tokens + wp db query "DELETE FROM wp_options WHERE option_name LIKE '_transient_hvac_cert_%' OR option_name LIKE '_transient_timeout_hvac_cert_%'" + echo "✓ Certificate tokens cleared" + + echo "" + echo "All certificate data has been cleared!" + ;; + + 2) + echo "" + echo "Clearing TEST certificates only..." + + # Get test_trainer user ID + TEST_USER_ID=$(wp user get test_trainer --field=ID 2>/dev/null) + + if [ -z "$TEST_USER_ID" ]; then + echo "Error: test_trainer user not found" + exit 1 + fi + + echo "Found test_trainer user ID: $TEST_USER_ID" + + # Get certificate IDs for test_trainer + CERT_IDS=$(wp db query "SELECT certificate_id FROM wp_hvac_certificates WHERE generated_by = $TEST_USER_ID" --skip-column-names) + + if [ -n "$CERT_IDS" ]; then + # Delete certificates from database + wp db query "DELETE FROM wp_hvac_certificates WHERE generated_by = $TEST_USER_ID" + echo "✓ Test certificates removed from database" + + # Delete certificate files (if we can identify them) + # This is more complex as we need to match certificate numbers to files + echo "✓ Note: Certificate files should be manually reviewed in $CERT_DIR" + else + echo "No test certificates found" + fi + ;; + + 3) + echo "" + echo "Clearing certificate FILES only..." + + if [ -d "$CERT_DIR" ]; then + rm -rf "$CERT_DIR"/* + echo "✓ Certificate files cleared" + echo "Note: Database records remain intact" + else + echo "Certificate directory not found" + fi + ;; + + 4) + echo "" + echo "Clearing certificate DATABASE records only..." + + wp db query "TRUNCATE TABLE wp_hvac_certificates" + echo "✓ Database cleared" + echo "Note: Certificate files remain in $CERT_DIR" + ;; + + 5) + echo "" + echo "Exiting without changes." + exit 0 + ;; + + *) + echo "" + echo "Invalid choice. Exiting." + exit 1 + ;; +esac + +echo "" +echo "=== Cleanup Complete ===" +echo "" +echo "To regenerate test certificates:" +echo "1. Log in as test_trainer" +echo "2. Navigate to Generate Certificates page" +echo "3. Select an event and attendees" +echo "4. Generate new certificates" \ No newline at end of file diff --git a/wordpress-dev/bin/regenerate-certificate-test-data.sh b/wordpress-dev/bin/regenerate-certificate-test-data.sh new file mode 100755 index 00000000..01bf3c40 --- /dev/null +++ b/wordpress-dev/bin/regenerate-certificate-test-data.sh @@ -0,0 +1,203 @@ +#!/bin/bash + +# Script to regenerate certificate test data on staging server +# This script should be run on the staging server + +echo "=== Certificate Test Data Regeneration Script ===" +echo "" + +# Check if wp-cli is available +if ! command -v wp &> /dev/null; then + echo "Error: wp-cli is not installed or not in PATH" + exit 1 +fi + +# Navigate to WordPress directory +cd /home/uberrxmprk/cloudwaysapps.com/rfymqitokx/public_html + +# Get test_trainer user ID +TEST_USER_ID=$(wp user get test_trainer --field=ID 2>/dev/null) + +if [ -z "$TEST_USER_ID" ]; then + echo "Error: test_trainer user not found" + echo "Please run ./bin/create-test-users.sh first" + exit 1 +fi + +echo "Found test_trainer user (ID: $TEST_USER_ID)" +echo "" + +# Get recent events +echo "Fetching recent events..." +EVENTS=$(wp db query " + SELECT p.ID, p.post_title, + DATE_FORMAT(m.meta_value, '%Y-%m-%d') as event_date + FROM wp_posts p + JOIN wp_postmeta m ON p.ID = m.post_id AND m.meta_key = '_EventStartDate' + WHERE p.post_type = 'tribe_events' + AND p.post_status = 'publish' + ORDER BY m.meta_value DESC + LIMIT 5 +" --skip-column-names) + +if [ -z "$EVENTS" ]; then + echo "No events found. Please create some test events first." + exit 1 +fi + +echo "Recent events:" +echo "$EVENTS" | nl +echo "" + +read -p "Enter the event number to use for test certificates (1-5): " EVENT_NUM + +EVENT_ID=$(echo "$EVENTS" | sed -n "${EVENT_NUM}p" | awk '{print $1}') +EVENT_TITLE=$(echo "$EVENTS" | sed -n "${EVENT_NUM}p" | cut -f2- -d$'\t' | cut -f1 -d$'\t') + +if [ -z "$EVENT_ID" ]; then + echo "Invalid selection" + exit 1 +fi + +echo "" +echo "Selected event: $EVENT_TITLE (ID: $EVENT_ID)" +echo "" + +# Get attendees for this event +echo "Fetching attendees for this event..." +ATTENDEE_COUNT=$(wp db query " + SELECT COUNT(*) + FROM wp_posts + WHERE post_type IN ('tec_tc_attendee', 'tribe_tpp_attendees', 'tribe_rsvp_attendees') + AND post_parent = $EVENT_ID +" --skip-column-names) + +echo "Found $ATTENDEE_COUNT attendees" + +if [ "$ATTENDEE_COUNT" -eq 0 ]; then + echo "" + echo "No attendees found. Would you like to create test attendees?" + read -p "Create test attendees? (y/n): " CREATE_ATTENDEES + + if [ "$CREATE_ATTENDEES" = "y" ]; then + echo "" + read -p "How many test attendees to create? (1-10): " NUM_ATTENDEES + + if [ "$NUM_ATTENDEES" -gt 0 ] && [ "$NUM_ATTENDEES" -le 10 ]; then + echo "Creating $NUM_ATTENDEES test attendees..." + + # This is a simplified version - in reality, creating attendees is complex + # and depends on the ticket system being used + echo "Note: Automatic attendee creation requires the ticket system to be properly configured." + echo "For now, please create attendees manually through the WordPress admin." + exit 0 + fi + fi + exit 0 +fi + +echo "" +echo "Ready to generate test certificates" +echo "" +echo "Options:" +echo "1) Generate certificates for ALL attendees" +echo "2) Generate certificates for first 5 attendees only" +echo "3) Generate certificates for checked-in attendees only" +echo "4) Exit without generating" +echo "" +read -p "Enter your choice (1-4): " GEN_CHOICE + +case $GEN_CHOICE in + 1) + ATTENDEE_IDS=$(wp db query " + SELECT ID + FROM wp_posts + WHERE post_type IN ('tec_tc_attendee', 'tribe_tpp_attendees', 'tribe_rsvp_attendees') + AND post_parent = $EVENT_ID + " --skip-column-names) + ;; + 2) + ATTENDEE_IDS=$(wp db query " + SELECT ID + FROM wp_posts + WHERE post_type IN ('tec_tc_attendee', 'tribe_tpp_attendees', 'tribe_rsvp_attendees') + AND post_parent = $EVENT_ID + LIMIT 5 + " --skip-column-names) + ;; + 3) + ATTENDEE_IDS=$(wp db query " + SELECT p.ID + FROM wp_posts p + JOIN wp_postmeta m ON p.ID = m.post_id + WHERE p.post_type IN ('tec_tc_attendee', 'tribe_tpp_attendees', 'tribe_rsvp_attendees') + AND p.post_parent = $EVENT_ID + AND m.meta_key = '_tribe_tickets_attendee_checked_in' + AND m.meta_value = '1' + " --skip-column-names) + ;; + 4) + echo "Exiting without generating certificates." + exit 0 + ;; + *) + echo "Invalid choice" + exit 1 + ;; +esac + +if [ -z "$ATTENDEE_IDS" ]; then + echo "No attendees found matching criteria" + exit 0 +fi + +ATTENDEE_COUNT=$(echo "$ATTENDEE_IDS" | wc -l) +echo "" +echo "Generating certificates for $ATTENDEE_COUNT attendees..." +echo "" + +# Generate certificates using WP-CLI eval-file +cat > /tmp/generate_certs.php << 'EOF' +generate_certificate($event_id, $attendee_id, array(), $generated_by); + + if ($result) { + $success++; + echo "✓ Generated certificate for attendee $attendee_id\n"; + } else { + $failed++; + echo "✗ Failed to generate certificate for attendee $attendee_id\n"; + } +} + +echo "\nSummary:\n"; +echo "Successful: $success\n"; +echo "Failed: $failed\n"; +EOF + +wp eval-file /tmp/generate_certs.php "$EVENT_ID" "$ATTENDEE_IDS" "$TEST_USER_ID" + +rm -f /tmp/generate_certs.php + +echo "" +echo "=== Certificate Generation Complete ===" +echo "" +echo "To view the generated certificates:" +echo "1. Log in as test_trainer" +echo "2. Navigate to Certificate Reports page" +echo "3. Or check the uploads directory at:" +echo " /wp-content/uploads/hvac-certificates/" \ No newline at end of file diff --git a/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/clear-test-certificates.php b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/clear-test-certificates.php new file mode 100644 index 00000000..8fc56f94 --- /dev/null +++ b/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/clear-test-certificates.php @@ -0,0 +1,266 @@ + + + +
+Choose an action to perform:
+ + Clear All Certificates + + 0): ?> + Clear Test Certificates Only + + + 0): ?> + Clear Certificate Files Only + + + Back to Dashboard +After clearing certificates, you can regenerate test data by:
+Update your trainer profile with your credentials, business information, and training specialties. This helps trainees find and trust your expertise.
- Edit Profile +Everything starts at your dashboard. See your total events, upcoming trainings, revenue progress, and quick links to all features. No need to access WordPress admin!
+ Go to DashboardUse our event creation form to set up your training. Include detailed descriptions, pricing, and capacity limits.
+Click "Create Event" from any page. Fill in the simple form - event title, description, date, and pricing. Your event saves as a draft automatically.
Create EventTrack your events, revenue, and performance metrics from your centralized dashboard.
- View Dashboard +Add your credentials and business info to build trust with trainees. A complete profile helps your events get found and booked faster.
+ Edit ProfileAccess detailed event information including attendee lists, sales data, and check-in capabilities. Each event has its own summary page accessible from your dashboard.
+Click "View Summary" on any event to see everything at a glance: attendee list, revenue, check-in status, and quick links to email attendees or generate certificates.
View all registrations, payment status, and attendee information from your event summary page. Export attendee lists for your records.
+Your dashboard shows registration counts. Click "View Attendees" on any event to see the full list with names, emails, and check-in status.
Send emails to all attendees or specific groups. Use our email templates or create custom messages for updates and reminders.
+Click "Email Attendees" to send updates. Select all attendees or just those who are checked in. Add CC recipients and your message is sent instantly.
Mark attendees as present during your event. This data is used for certificate generation and completion tracking.
+During your event, use the attendee list to check people in. This helps track completion for certificates and keeps accurate records.
Create professional certificates for attendees who completed your training. Certificates include event details, your signature, and completion date.
+Generate professional certificates with the Upskill HVAC logo, your name as instructor, and attendee details. Each certificate has a unique number and can be verified.
Track which certificates have been issued and manage your certificate templates from the Certificate Reports page.
+The Certificate Reports page shows all certificates you\'ve issued. Filter by event, search by name, and download certificates anytime.
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).
+Start at your dashboard! It shows everything you need. Click "Create Event" to add your first training, or "My Events" to see what you\'ve already created.
Our review process typically takes 1-2 business days. We check for content quality, appropriate pricing, and compliance with industry standards.
+From your dashboard, find the event and click its title. You\'ll go straight to the edit page. Make changes and click "Update Event" to save.
Yes, you can edit event details, but significant changes may require re-review. We recommend finalizing details before initial submission.
+After your event, go to "Generate Certificates" and select your event. Choose which attendees get certificates (usually those who were checked in). Click generate and they\'re ready! Each certificate shows your name, the attendee\'s name, and has the Upskill HVAC logo.
Contact our support team immediately. We\'ll help you manage refunds and communicate with registered attendees.
+Yes! On the Generate Certificates page, you\'ll see "Certificate Issued" under each attendee who has one. Click this text to open their certificate - you can share this link with them.
Complete your profile thoroughly, use detailed event descriptions, competitive pricing, and maintain high attendance rates. Quality events get featured prominently.
+This is your annual goal to maintain your trainer status. The progress bar shows how close you are. Keep creating quality events and you\'ll reach it!
Yes! You can offer in-person, virtual, hybrid, and on-demand training formats. Set your preferred training locations and formats in your profile.
+Click "Email Attendees" from the menu or from any event summary. Select who to email, write your message, and send. You can CC yourself or others too.
Access this documentation anytime, use the help tooltips throughout the platform, or contact our support team for personalized assistance.
+No! Everything you need is in your trainer dashboard and the connected pages. The system is designed so you never need to access the WordPress backend.
+Attendees pay through Stripe when they register. You receive 100% of ticket sales (minus Stripe\'s standard 2.9% + 30¢ fee) directly to your connected account.
+Look for the (?) tooltips throughout the site - hover over them for quick help. This documentation is always available from the Help link. For urgent issues, contact support.