upskill-event-manager/bin/create-test-users.sh
Ben 27af93a398 fix: Resolve trainer dashboard template and navigation issues
- Remove hardcoded template override in class-hvac-community-events.php forcing old shortcode-based template
- Update dashboard to use refactored page-trainer-dashboard.php template with proper WordPress integration
- Fix navigation menu rendering by removing conflicting HVAC_NAV_RENDERED constant checks
- Add missing hvac-menu-system.css file to resolve navigation styling
- Update deployment script to automatically assign correct page template
- Clean up template files to use consistent navigation rendering approach
- Update documentation with dashboard refactoring details

The dashboard now displays correctly with working navigation across all trainer pages.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 16:28:26 -03:00

93 lines
No EOL
3.3 KiB
Bash
Executable file

#!/bin/bash
# Create test users on staging server
source .env
echo "=== Creating Test Users on Staging Server ==="
echo "Server: $UPSKILL_STAGING_IP"
echo "Path: $UPSKILL_STAGING_PATH"
# Create PHP script to add test users
cat << 'EOF' > /tmp/create-test-users.php
<?php
// Load WordPress
require_once('wp-load.php');
echo "Creating test users...\n";
// Create test_trainer user
$user_id = wp_create_user('test_trainer', 'TestTrainer123!', 'test_trainer@example.com');
if (!is_wp_error($user_id)) {
$user = new WP_User($user_id);
$user->set_role('hvac_trainer');
update_user_meta($user_id, 'first_name', 'Test');
update_user_meta($user_id, 'last_name', 'Trainer');
update_user_meta($user_id, 'hvac_account_status', 'active');
echo "✅ Created test_trainer (password: TestTrainer123!)\n";
} else {
echo "⚠️ test_trainer may already exist\n";
}
// Create test_master user
$user_id = wp_create_user('test_master', 'TestMaster123!', 'test_master@example.com');
if (!is_wp_error($user_id)) {
$user = new WP_User($user_id);
$user->set_role('hvac_master_trainer');
update_user_meta($user_id, 'first_name', 'Test');
update_user_meta($user_id, 'last_name', 'Master');
update_user_meta($user_id, 'hvac_account_status', 'active');
echo "✅ Created test_master (password: TestMaster123!)\n";
} else {
echo "⚠️ test_master may already exist\n";
}
// Also ensure Joe accounts exist
$joe_user = get_user_by('email', 'JoeMedosch@gmail.com');
if (!$joe_user) {
$user_id = wp_create_user('joemedosch', 'JoeTrainer2025@', 'JoeMedosch@gmail.com');
if (!is_wp_error($user_id)) {
$user = new WP_User($user_id);
$user->set_role('hvac_master_trainer');
update_user_meta($user_id, 'first_name', 'Joe');
update_user_meta($user_id, 'last_name', 'Medosch');
update_user_meta($user_id, 'hvac_account_status', 'active');
echo "✅ Created JoeMedosch@gmail.com (password: JoeTrainer2025@)\n";
}
} else {
echo "⚠️ JoeMedosch@gmail.com already exists\n";
}
// Check joe@upskillhvac.com
$joe_upskill = get_user_by('email', 'joe@upskillhvac.com');
if ($joe_upskill) {
// Ensure has both roles
$joe_upskill->add_role('hvac_trainer');
$joe_upskill->add_role('hvac_master_trainer');
update_user_meta($joe_upskill->ID, 'hvac_account_status', 'active');
echo "✅ Updated joe@upskillhvac.com with both roles\n";
}
echo "\nTest users ready!\n";
EOF
# Copy and execute on staging
echo "Uploading script to staging server..."
sshpass -p "$UPSKILL_STAGING_SSH_PASS" scp -o StrictHostKeyChecking=no /tmp/create-test-users.php $UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP:/tmp/
echo "Executing script on staging server..."
sshpass -p "$UPSKILL_STAGING_SSH_PASS" ssh -o StrictHostKeyChecking=no $UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP << REMOTE_COMMANDS
cd $UPSKILL_STAGING_PATH
cp /tmp/create-test-users.php ./
wp eval-file create-test-users.php
rm create-test-users.php
rm /tmp/create-test-users.php
REMOTE_COMMANDS
echo "=== Test Users Created ==="
echo ""
echo "You can now log in with:"
echo "1. test_trainer / TestTrainer123! (Regular trainer)"
echo "2. test_master / TestMaster123! (Master trainer)"
echo "3. JoeMedosch@gmail.com / JoeTrainer2025@ (Master trainer)"
echo ""
echo "Login at: https://upskill-staging.measurequick.com/training-login/"