Seamless Awesome Support Guest Tickets with Custom Registration & Ticket Migration
If you’re looking for custom WordPress integrations that solve real business problems, explore my WordPress & Plugin Development portfolio
or WordPress development services, and feel free to get in touch.
Overview
I developed a sophisticated integration between Awesome Support
and a custom registration system that combines guest ticket functionality with Stripe Identity verification. The solution automatically handles
duplicate user scenarios by preserving existing tickets during account migration, implements smart email verification logic, and provides
seamless user experience transitions from guest to verified registered users.
Challenge
The client needed to solve several interconnected problems:
- Guest ticket preservation — Users who submitted support tickets as guests should retain access after registration
- Duplicate account prevention — Email-based registration could create conflicts with existing guest accounts
- Seamless verification flow — Multi-step registration with Stripe Identity verification and email confirmation
- Smart email handling — Different behavior for verified vs. unverified existing users
- Auto-progression UX — Automatic advancement through registration steps after successful verification
Solution Architecture
I designed a multi-layered solution that handles user lifecycle management while preserving data integrity:
- Pre-Registration Cleanup — Detect existing users by email, identify associated tickets, safely remove duplicate accounts while preserving ticket data via WordPress transients.
- Smart Registration Flow — Multi-step process with Stripe Identity verification, email validation, and automatic progression between steps.
- Ticket Migration System — Automatic transfer of guest tickets to newly created accounts using WordPress post author updates and transient-based data persistence.
- Intelligent Email Verification — Context-aware email verification that handles existing users differently based on their verification status.
Implementation Highlights
1) Intelligent User Cleanup with Ticket Preservation
The system detects existing users during registration and implements a sophisticated cleanup process that preserves valuable data. When a user attempts to register with an existing email:
- Query for tickets with
post_type=ticket
assigned to the existing user - Store ticket IDs in WordPress transients with email-based keys for temporary persistence
- Safely delete the existing user account using
wp_delete_user()
- Return ticket count information for tracking and logging
Key implementation in delete_existing_user_by_email()
:
// Check for tickets assigned to this user
$tickets = get_posts(array(
'post_type' => 'ticket',
'author' => $existing_user->ID,
'post_status' => 'any',
'numberposts' => -1,
'fields' => 'ids'
));
// Store ticket IDs in a transient for later transfer
if (!empty($tickets)) {
set_transient('stripe_identity_tickets_to_transfer_' . $email, $tickets, 300);
}
2) Automatic Ticket Migration
After successful user registration, the system automatically transfers preserved tickets to the new account.
This happens seamlessly during the woocommerce_created_customer
hook:
- Retrieve stored ticket IDs from transients using the user’s email
- Update each ticket’s
post_author
to the new user ID - Track successful transfers and log results
- Clean up transient data to prevent memory leaks
This ensures zero data loss during the account migration process while maintaining WordPress post relationships.
3) Multi-Step Registration with Auto-Progression
Built a sophisticated multi-step registration using jQuery Steps with intelligent progression logic:
- Step 1: Email verification with OTP system
- Step 2: Stripe Identity verification with auto-advance
- Step 3: Personal information collection
- Step 4: Address details and final submission
The system automatically advances users after successful Stripe verification with a 2-second delay for user feedback:
if (response.data.status === 'verified') {
// Auto-advance to next step after successful verification
setTimeout(function() {
jQuery('#stripe-id-form').steps('next');
}, 2000);
}
4) Smart Email Verification Logic
Implemented context-aware email verification that behaves differently based on existing user status:
- New users: Standard email verification with OTP
- Existing verified users: Block registration with appropriate error message
- Existing unverified users: Allow re-verification and account completion
The logic checks user meta for has_verified_email
status:
$existing_user = get_user_by('email', $email);
if ($existing_user) {
$is_email_verified = get_user_meta($existing_user->ID, 'has_verified_email', true);
if ($is_email_verified) {
// Block verified users
wp_send_json_error(['message' => 'Email already registered and verified']);
} else {
// Allow unverified users to complete registration
// Continue with OTP process...
}
}
5) Enhanced User Experience Features
Added several UX improvements to streamline the registration process:
- Form field auto-population: Email input triggers and validation events
- Visual feedback: Loading states and progress indicators
- Automatic form submission: Seamless transition after ticket cleanup
- KYC completion tracking: Meta flags for successful verification states
Email field enhancements with jQuery triggers:
jQuery('#reg_email').trigger('input').trigger('change').trigger('blur');
6) Secure AJAX Implementation
All AJAX operations follow WordPress security best practices:
- Nonce verification:
check_ajax_referer('stripe_identity_nonce', 'nonce')
- Capability checks: Appropriate permission validation
- Input sanitization:
sanitize_email()
and other WordPress sanitization functions - Error handling: Comprehensive error logging and user feedback
Technical Implementation Details
Registered AJAX handlers for all custom functionality:
// User deletion and ticket transfer
add_action('wp_ajax_delete_existing_user_by_email', 'delete_existing_user_by_email');
add_action('wp_ajax_nopriv_delete_existing_user_by_email', 'delete_existing_user_by_email');
// Email verification system
add_action('wp_ajax_stripe_identity_send_email_verification', 'stripe_identity_send_email_verification');
add_action('wp_ajax_nopriv_stripe_identity_send_email_verification', 'stripe_identity_send_email_verification');
// Customer creation hook for ticket transfer
add_action('woocommerce_created_customer', 'stripe_identity_save_extra_register_fields');
Data Management
Used WordPress transients for temporary data storage with automatic cleanup:
- Storage:
set_transient('key', $data, 300)
— 5-minute expiry - Retrieval:
get_transient('key')
- Cleanup:
delete_transient('key')
after successful transfer
User Meta Management
Implemented comprehensive user meta tracking:
has_verified_email
— Email verification statushas_successfuly_completed_kyc
— KYC completion flagtransferred_tickets_count
— Number of tickets migratedstripe_identity_verified
— Stripe verification status
Integration Benefits
- Zero data loss: Complete preservation of guest ticket history during registration
- Seamless UX: Automatic progression and intelligent form handling
- Security compliance: Proper nonce verification and capability checks
- Maintainable code: WordPress coding standards and clear separation of concerns
- Scalable architecture: Transient-based storage handles high-volume scenarios
- Admin visibility: Comprehensive logging and meta tracking for support teams
Performance Considerations
- Efficient queries: Targeted post queries with specific fields to minimize database load
- Transient expiry: Automatic cleanup prevents database bloat
- Batch operations: Single database update per ticket during transfer
- Conditional processing: Only process transfers when tickets exist
Error Handling & Logging
Comprehensive error handling ensures system reliability:
- User deletion failures: Graceful handling with continued registration flow
- Ticket transfer errors: Individual ticket failure doesn’t stop batch processing
- Transient failures: Fallback mechanisms for data persistence issues
- AJAX errors: User-friendly error messages and admin logging
Future Enhancements
- Bulk ticket operations: Admin interface for manual ticket transfers
- Audit trails: Detailed logging of all user and ticket operations
- Advanced filters: Custom ticket queries based on status, date, priority
- Integration webhooks: Real-time notifications for ticket transfers
- Data export: CSV/JSON export of ticket migration reports
Files & Components
WordPress Core Files:
public/class-stripe-identity-public.php
— Main public functionality and AJAX handlersincludes/class-stripe-identity.php
— Hook registration and plugin initializationpublic/js/stripe-identity-public.js
— Frontend JavaScript and form handlingpublic/css/stripe-identity-public.css
— Custom styling for registration components
Key Methods:
delete_existing_user_by_email()
— User cleanup with ticket preservationstripe_identity_save_extra_register_fields()
— Customer creation and ticket transferstripe_identity_send_email_verification()
— Smart email verification logic
WordPress & Plugin APIs
WordPress: wp_delete_user, get_posts, wp_update_post, set_transient, update_user_meta.
WooCommerce: woocommerce_created_customer, woocommerce_register_post.
Awesome Support: Plugin Documentation, Official Docs.
FAQ
What happens to guest tickets during registration?
Guest tickets are automatically preserved and transferred to the new registered account. The system uses WordPress transients to temporarily store ticket IDs during the user migration process.
How does the email verification handle existing users?
The system checks if existing users have verified emails. Verified users are blocked from re-registration, while unverified users can complete the registration process and receive OTP codes.
What if the ticket transfer fails?
Individual ticket transfer failures don’t stop the registration process. Failed transfers are logged for admin review, and the user can still access their new account normally.
Is this compatible with other support plugins?
The implementation is specifically designed for Awesome Support but the pattern can be adapted for other ticket systems that use custom post types with author relationships.
How long are ticket IDs stored during transfer?
Ticket IDs are stored in WordPress transients for 5 minutes (300 seconds) to handle the registration process, then automatically cleaned up to prevent database bloat.
For similar WordPress integrations and custom development work, see my portfolio or contact me to discuss your project requirements.