Skip to content

Repository files navigation

Resume Parser WordPress Plugin

A powerful WordPress plugin that transforms any form field into an intelligent resume parser. Simply add a CSS class to any input field to enable automatic resume parsing, field population, and hidden data storage.

πŸš€ Key Features

Invisible Resume Parser

  • Class-Based Auto-Detection: Add resume-parser-field class to any form field to enable parsing
  • Multiple Input Methods: File inputs, text fields, and textareas all supported
  • Smart Interaction: Double-click, Ctrl+U, or drag & drop files onto any parser field
  • Universal Compatibility: Works with Contact Form 7, Gravity Forms, custom forms, any CSS framework

Advanced Functionality

  • File Upload: Supports PDF, DOC, and DOCX resume formats
  • Smart Field Population: Automatically fills form fields with relevant resume data
  • Editable Hidden Fields: All parsed data stored as editable hidden fields with toggle interface
  • Custom Field Addition: Users can add/remove additional resume fields dynamically
  • Submit Button Protection: Auto-disables submit for 15 seconds during processing
  • Binary Data Handling: Converts uploaded files to base64 binary format for API transmission
  • AJAX Processing: Asynchronous file upload and processing with real-time feedback

Integration & Compatibility

  • Shortcode Integration: Traditional shortcode support for dedicated resume forms
  • API Integration: Send resume data to external parsing services
  • Form Framework Agnostic: Works with any HTML form or WordPress form plugin
  • Responsive Design: Mobile-friendly interface with modern styling
  • Error Handling: Comprehensive error handling and user feedback
  • Security: Nonce verification, file type validation, and CSRF protection

Installation

  1. Upload the resume-parser folder to your /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Use the [resume_parser] shortcode in your pages, posts, or forms

🎯 Usage

Method 1: Invisible Class-Based Parser (Recommended)

Simply add the resume-parser-field class to any form field to enable automatic resume parsing:

File Input Fields

<input
  type="file"
  name="resume"
  class="resume-parser-field"
  accept=".pdf,.doc,.docx"
/>
  • βœ… Automatic parsing when file is selected
  • βœ… Drag & drop support
  • βœ… Hidden fields created with parsed data

Text/Textarea Fields

<input
  type="text"
  name="applicant_name"
  class="resume-parser-field"
  placeholder="Enter name or upload resume"
/>
<textarea
  name="experience"
  class="resume-parser-field"
  placeholder="Experience or upload resume"
></textarea>
  • βœ… Double-click to upload resume
  • βœ… Ctrl+U keyboard shortcut
  • βœ… Drag & drop files onto field
  • βœ… Auto-populate field + create hidden fields

User Interaction Methods

  1. File Input: Select file normally or drag & drop
  2. Text Fields: Double-click, press Ctrl+U, or drag & drop resume file
  3. All Methods: Resume gets parsed and hidden fields created automatically

Method 2: Traditional Shortcodes

Basic Shortcode

[resume_parser]

Advanced Shortcode with Custom Fields

[resume_parser fields="name,email,phone,experience,education,skills,summary" api_endpoint="https://your-api.com/parse" class="my-custom-class"]

Debug Shortcode

[resume_parser_debug]

Add this to any page to troubleshoot parser functionality.

Shortcode Parameters

  • fields: Comma-separated list of fields to display (default: name,email,phone,experience,education,skills)
  • api_endpoint: URL of your resume parsing API service
  • class: Additional CSS class for styling

Available Fields

  • name - Full name
  • email - Email address
  • phone - Phone number
  • experience - Work experience (textarea)
  • education - Education background (textarea)
  • skills - Technical skills (textarea)
  • summary - Professional summary (textarea)

API Integration

Sending Data to External API

When an api_endpoint is provided, the plugin will send a POST request with the following JSON structure:

{
  "file_name": "resume.pdf",
  "file_type": "application/pdf",
  "file_data": "base64_encoded_file_content"
}

Expected API Response

Your API should return a JSON response with the parsed data:

{
  "name": "John Doe",
  "email": "john.doe@example.com",
  "phone": "+1 (555) 123-4567",
  "experience": "Software Developer with 5+ years...",
  "education": "Bachelor of Science in Computer Science...",
  "skills": "PHP, JavaScript, WordPress, React..."
}

Error Response

For errors, return:

{
  "error": true,
  "message": "Error description"
}

🎨 Hidden Fields & Data Management

Automatic Hidden Fields Creation

When a resume is parsed, the plugin automatically creates hidden fields before the submit button:

<!-- Example of auto-generated hidden fields -->
<div class="resume-parser-hidden-fields" data-trigger="applicant_name">
  <div class="resume-parser-header">
    πŸ“„ Resume Data Parsed (8 fields) [Show/Edit Fields β–Ό]
  </div>
  <div class="resume-fields-list" style="display: none;">
    <input type="text" name="resume_name" value="John Smith" />
    <input type="text" name="resume_email" value="john@example.com" />
    <input type="text" name="resume_phone" value="+1-555-123-4567" />
    <textarea name="resume_experience">
Software Developer with 5+ years...</textarea
    >
    <!-- ... more fields ... -->
  </div>
</div>

User-Editable Interface

  • βœ… Toggle Visibility: Users can show/hide parsed data
  • βœ… Edit Fields: All hidden fields are editable before submission
  • βœ… Copy to Target: Quick copy buttons for name, email, phone fields
  • βœ… Add Custom Fields: Users can add additional resume data
  • βœ… Remove Fields: Delete unwanted parsed fields

Submit Button Protection

  • βœ… Auto-Disable: Submit button disabled during processing
  • βœ… Countdown Timer: Shows countdown (max 15 seconds)
  • βœ… Early Enable: Re-enables immediately when processing completes
  • βœ… Force Enable: Automatically enables after 15 seconds maximum

Form Integration Examples

Contact Form 7

<label
  >Name* [text name class:resume-parser-field placeholder "Enter name or upload
  resume"]
</label>

<label
  >Email* [email email class:resume-parser-field placeholder "Enter email or
  upload resume"]
</label>

<label
  >Experience [textarea experience class:resume-parser-field placeholder
  "Describe experience or upload resume"]
</label>

Custom HTML Form

<form method="post">
  <label>Applicant Name:</label>
  <input
    type="text"
    name="applicant_name"
    class="resume-parser-field"
    required
  />

  <label>Upload Resume:</label>
  <input
    type="file"
    name="resume_file"
    class="resume-parser-field"
    accept=".pdf,.doc,.docx"
  />

  <label>Experience:</label>
  <textarea name="experience" class="resume-parser-field"></textarea>

  <input type="submit" value="Submit Application" />
</form>

Gravity Forms

Add resume-parser-field as a CSS class in the field settings.

🎨 Styling

The plugin includes minimal CSS that doesn't interfere with your theme. Key CSS classes:

Parser Fields

  • .resume-parser-field - Fields with parser capability
  • .resume-parser-loading - Loading state styling
  • .resume-parser-dragover - Drag over state
  • .populated - Successfully populated field animation

Hidden Fields Interface

  • .resume-parser-hidden-fields - Container for hidden fields
  • .resume-parser-header - Toggle header
  • .resume-fields-list - Editable fields container
  • .resume-field-row - Individual hidden field row

Traditional Shortcode

  • .resume-parser-container - Main container
  • .resume-upload-section - File upload area
  • .resume-fields-section - Form fields area
  • .resume-field - Individual form fields
  • .resume-upload-progress - Progress indicator

πŸ’» JavaScript Events & Advanced Usage

Custom Events

The plugin triggers custom events that you can listen to:

// When fields are populated
$(document).on("resume_fields_populated", function (e, data) {
  console.log("Resume data:", data);
});

// When upload starts
$(document).on("resume_upload_start", function (e) {
  console.log("Upload started");
});

// When upload completes
$(document).on("resume_upload_complete", function (e, success, data) {
  console.log("Upload complete:", success, data);
});

// When hidden fields are created
$(document).on("resume_hidden_fields_created", function (e, fieldName, data) {
  console.log("Hidden fields created for:", fieldName, data);
});

Global Functions

The plugin exposes global functions for advanced customization:

// Toggle resume fields visibility
toggleResumeFields("field_name");

// Copy parsed data to target field
copyToTarget("source_field_id", "target_field_name");

// Add custom resume field
addCustomResumeField("field_name");

// Remove custom field
removeCustomField(buttonElement);

// Manually disable/enable submit button
disableSubmitButton($form, "field_name");
enableSubmitButton($form, "field_name");

Advanced Customization

// Customize field mapping
$(document).ready(function () {
  // Override default field value mapping
  window.customFieldMapping = function (data, fieldName, $targetField) {
    if (fieldName === "special_field") {
      return data.custom_value || data.name;
    }
    return null; // Use default mapping
  };
});

// Custom submit button behavior
$(document).on("resume_processing_start", function (e, fieldName) {
  console.log("Processing started for:", fieldName);
  // Add custom loading indicators
});

$(document).on("resume_processing_complete", function (e, fieldName, success) {
  console.log("Processing completed for:", fieldName, "Success:", success);
  // Add custom success/error handling
});

Security Features

  • Nonce Verification: All AJAX requests are protected with WordPress nonces
  • File Type Validation: Only PDF, DOC, and DOCX files are allowed
  • Sanitization: All input data is properly sanitized
  • CSRF Protection: Built-in protection against cross-site request forgery

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 11+
  • Edge 79+
  • IE 11+ (limited support)

Requirements

  • WordPress 5.0 or higher
  • PHP 7.0 or higher
  • jQuery (included with WordPress)

Hooks and Filters

Filters

// Modify allowed file types
add_filter('resume_parser_allowed_types', function($types) {
    $types[] = 'text/plain'; // Add TXT files
    return $types;
});

// Modify API request data
add_filter('resume_parser_api_data', function($data, $file) {
    $data['additional_field'] = 'value';
    return $data;
}, 10, 2);

// Modify shortcode output
add_filter('resume_parser_shortcode_output', function($output, $atts) {
    // Customize the HTML output
    return $output;
}, 10, 2);

Actions

// Before file processing
add_action('resume_parser_before_upload', function($file_data) {
    // Log upload attempt
});

// After successful parsing
add_action('resume_parser_after_success', function($parsed_data) {
    // Save to database, send email, etc.
});

// After parsing error
add_action('resume_parser_after_error', function($error_message) {
    // Log error, notify admin, etc.
});

Example Integration

Contact Form 7 Integration

// In your theme's functions.php
add_action('wpcf7_before_send_mail', function($contact_form) {
    // Get resume data from session or database
    $resume_data = get_transient('resume_data_' . session_id());

    if ($resume_data) {
        // Add resume data to email
        $mail = $contact_form->prop('mail');
        $mail['body'] .= "\n\nResume Data:\n" . print_r($resume_data, true);
        $contact_form->set_properties(['mail' => $mail]);
    }
});

Gravity Forms Integration

// Auto-populate Gravity Forms fields
add_filter('gform_field_value', function($value, $field, $name) {
    $resume_data = get_transient('resume_data_' . session_id());

    if ($resume_data && isset($resume_data[$name])) {
        return $resume_data[$name];
    }

    return $value;
}, 10, 3);

πŸ”§ Troubleshooting

Debug Tools

  1. Add Debug Shortcode

    [resume_parser_debug]

    This creates a diagnostic panel that shows:

    • Plugin loading status
    • Field detection results
    • AJAX configuration
    • Real-time console output
  2. Browser Console Inspection

    • Press F12 β†’ Console tab
    • Look for "Resume Parser:" messages
    • Check for JavaScript errors

Common Issues

1. Class-Based Parser Not Working

// Check if fields are detected
console.log("Parser fields found:", $(".resume-parser-field").length);

// Check if events are attached
$(".resume-parser-field").each(function () {
  console.log(
    "Events for",
    $(this).attr("name"),
    Object.keys($._data(this, "events") || {})
  );
});

Solutions:

  • βœ… Ensure resume-parser-field class is spelled correctly
  • βœ… Check that jQuery is loaded
  • βœ… Verify plugin is activated
  • βœ… Clear cache if using caching plugins

2. File Upload Fails

Check Console For:

  • "resumeParser object not found" β†’ Plugin scripts not loading
  • "AJAX endpoint not found" (404) β†’ WordPress AJAX issues
  • "Network connection failed" (0) β†’ Server connectivity issues

Solutions:

  • βœ… Check file size limits in PHP configuration
  • βœ… Verify file permissions
  • βœ… Ensure allowed file types are correct (.pdf, .doc, .docx)
  • βœ… Test with smaller files first

3. API Integration Not Working

Check Console For:

  • API endpoint configuration
  • AJAX request/response details
  • Server error messages

Solutions:

  • βœ… Verify API endpoint URL in Settings β†’ Resume Parser
  • βœ… Check API response format matches expected JSON
  • βœ… Review server logs for errors
  • βœ… Test API endpoint with tools like Postman

4. Fields Not Populating

Debug Steps:

// Check if field detection works
console.log("Target field found:", $('[name="field_name"]').length);

// Check parsed data
console.log("Parsed data received:", responseData);

Solutions:

  • βœ… Check JavaScript console for errors
  • βœ… Verify field names/classes match expectations
  • βœ… Ensure API returns proper JSON format
  • βœ… Test with simple field names first

5. Submit Button Issues

Symptoms:

  • Button stays disabled
  • Countdown doesn't work
  • Multiple processing conflicts

Solutions:

// Manually re-enable if stuck
enableSubmitButton($("form"), "field_name", true);

// Check button state
console.log(
  "Submit buttons:",
  $('input[type="submit"], button[type="submit"]').length
);

6. Hidden Fields Not Created

Check:

  • Form structure (fields must be inside <form>)
  • Submit button exists in form
  • No JavaScript errors during processing

7. Styling Issues

Solutions:

  • βœ… Check for CSS conflicts with !important rules
  • βœ… Verify file paths are correct
  • βœ… Use browser developer tools to debug
  • βœ… Test with theme's default styling

Performance Optimization

// Reduce console logging in production
window.resumeParserDebug = false;

// Optimize for large forms
$(".resume-parser-field")
  .slice(0, 5)
  .each(function () {
    // Limit to first 5 fields if needed
  });

Support

For support and bug reports, please create an issue in the plugin repository or contact the plugin author.

License

This plugin is licensed under the GPL v2 or later.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages