WP Manifestindependent plugin directory
manifest / forms / as-reply-limit

Awesome Support Reply Limit

Limits the character count for Awesome Support reply forms with real-time validation and visual feedback.

by SPARKWEB Studio · github.com/spkcd/as-reply-limit · website

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/spkcd/as-reply-limit/archive/refs/heads/main.zip

A WordPress plugin that limits the character count for Awesome Support reply forms with real-time validation and visual feedback.

Plugin URI: https://sparkwebstudio.com
Author: SPARKWEB Studio
Version: 1.0.0
License: GPL v2 or later

Description

The Awesome Support Reply Limit plugin provides character count limitations for support ticket replies, ensuring concise and manageable communication between customers and support teams. The plugin features both frontend JavaScript validation with real-time feedback and backend PHP validation for security.

Features

✨ Frontend Features

  • Real-time character counting with visual countdown
  • Progressive color feedback (gray → orange → red)
  • Smart form detection for Awesome Support forms
  • Prevents typing beyond limit while allowing navigation keys
  • Handles paste operations with automatic truncation
  • Form submission blocking when limit is exceeded
  • Visual flash warnings when attempting to exceed limit
  • Mobile responsive design

🛡️ Backend Features

  • Server-side validation as security fallback
  • Admin bypass capability for administrators and editors
  • Detailed error messages with character count information
  • WP_Error integration with Awesome Support error handling

🎨 Styling Features

  • Professional CSS styling that integrates with WordPress themes
  • Dark theme support via CSS media queries
  • Responsive design for mobile devices
  • Smooth animations and transitions
  • Multiple visual states for different character count levels

Requirements

  • WordPress: 5.0 or higher
  • PHP: 7.4 or higher
  • Awesome Support Plugin: Any compatible version
  • Modern browser with JavaScript enabled (for frontend features)

Installation

See INSTALL.md for detailed installation instructions.

Quick Installation

  1. Download the plugin files
  2. Upload to /wp-content/plugins/awesome-support-reply-limit/
  3. Activate the plugin through WordPress admin
  4. The plugin works automatically on pages with Awesome Support forms

Usage

Automatic Detection

The plugin automatically detects Awesome Support forms using multiple methods:

  • Shortcode detection: [supportcandy], [wpas_submit_ticket], [awesome_support], etc.
  • Page slug detection: Pages named 'support', 'tickets', 'submit-ticket', etc.
  • Plugin class detection: Checks for active Awesome Support installations
  • DOM element detection: Scans for support form elements in the page

Character Limit

  • Default limit: 500 characters
  • Warning threshold: 400 characters (80% of limit)
  • Admin bypass: Administrators and editors can exceed the limit
  • Configurable: Can be modified in the plugin code

Visual Feedback States

  1. Normal (0-400 chars): Gray text - "X characters remaining"
  2. Warning (401-499 chars): Orange text - "X characters remaining"
  3. Limit reached (500 chars): Red bold text - "Character limit reached!"
  4. Over limit: Red highlighted box with error message

Technical Details

File Structure

awesome-support-reply-limit/
├── awesome-support-reply-limit.php    # Main plugin file
├── assets/
│   ├── css/
│   │   └── reply-limit.css           # Frontend styles
│   └── js/
│       └── reply-limit.js            # Frontend functionality
├── README.md                         # This file
├── CHANGELOG.md                      # Version history
└── INSTALL.md                        # Installation guide

Hooks & Filters

Actions

  • init - Initialize plugin and load text domain
  • wp_enqueue_scripts - Enqueue frontend assets
  • wp_footer - Add DOM detection script

Filters

  • wpas_before_reply_insert - Backend validation hook
  • asrl_should_enqueue_scripts - Override script enqueuing logic

JavaScript API

The plugin exposes the following JavaScript object:

window.asrlData = {
    maxChars: 500,
    warningThreshold: 400,
    messages: {
        charactersRemaining: 'characters remaining',
        characterLimit: 'Character limit reached!',
        overLimit: 'You have exceeded the character limit by'
    }
};

CSS Classes

  • .asrl-character-countdown - Base counter element
  • .asrl-warning - Warning state (approaching limit)
  • .asrl-limit-reached - Limit reached state
  • .asrl-over-limit - Over limit state
  • .asrl-error-message - Form submission error message

Customization

Modifying Character Limit

To change the character limit, edit the $max_chars property in the main plugin file:

private $max_chars = 750; // Change from 500 to 750

Custom CSS

You can override the default styles by adding CSS to your theme:

.asrl-character-countdown {
    font-size: 14px;
    color: #333;
}

.asrl-character-countdown.asrl-warning {
    color: #f39c12;
}

Extending Functionality

Use the provided filter to customize when scripts are loaded:

add_filter('asrl_should_enqueue_scripts', function($should_enqueue) {
    // Custom logic here
    return $should_enqueue;
});

Browser Support

  • Chrome: 60+
  • Firefox: 55+
  • Safari: 12+
  • Edge: 79+
  • Mobile browsers: iOS Safari 12+, Chrome Mobile 60+

Troubleshooting

Plugin Not Working

  1. Check Awesome Support is active and functioning
  2. Clear browser cache and WordPress caches
  3. Check browser console for JavaScript errors
  4. Verify page has support forms using browser developer tools

Character Counter Not Appearing

  1. Check if scripts are loading in browser Network tab
  2. Try different Awesome Support shortcodes or page setups
  3. Check for JavaScript conflicts with other plugins
  4. Enable WordPress debug mode to see PHP errors

Backend Validation Not Working

  1. Check user permissions - admins bypass validation
  2. Verify Awesome Support hooks are available
  3. Check error logs for PHP errors
  4. Test with different user roles

Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with proper documentation
  4. Test thoroughly
  5. Submit a pull request

Support

For support and questions:

License

This plugin is licensed under the GPL v2 or later.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

Credits

Developed by SPARKWEB Studio - Professional WordPress Development


Last updated: December 2024