Skip to content

CloudContactAI/ccai-wordpress-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudContactAI Forms WordPress Plugin

A WordPress plugin that allows you to create forms to capture user information and send SMS messages through CloudContactAI.

Features

  • Create multiple forms with custom fields
  • Embed forms on any page or post using shortcodes
  • Send SMS messages to users who submit the form
  • Customize SMS message templates
  • Track form submissions
  • View SMS delivery status

Requirements

  • WordPress 5.0 or higher
  • PHP 7.2 or higher
  • Composer (for development)
  • CloudContactAI account with API credentials

Installation

For Users

  1. Download the plugin zip file
  2. Upload the plugin through the WordPress admin interface or extract to the /wp-content/plugins/ directory
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. Go to 'CCAI Forms' > 'Settings' to configure your CloudContactAI API credentials
  5. Create forms and embed them on your site using shortcodes

For Developers

  1. Clone the repository
git clone https://github.com/your-username/ccai-forms.git
  1. Install dependencies
cd ccai-forms
composer install
  1. Upload to your WordPress plugins directory or create a symlink

Usage

Creating a Form

  1. Go to 'CCAI Forms' > 'Add New Form'
  2. Fill in the form details:
    • Form Title: The title displayed on the form
    • Form Name: A unique identifier for the form (used in shortcodes)
    • Description: Optional description displayed above the form
    • Success Message: Message displayed after successful submission
    • SMS Template: The message template for SMS messages

Embedding a Form

Use the shortcode [ccai_form id="1"] or [ccai_form name="contact-form"] to embed a form on any page or post.

Additional shortcode attributes:

  • title: Override the form title
  • description: Override the form description
  • button_text: Change the submit button text
  • show_title: Set to 'no' to hide the title
  • show_description: Set to 'no' to hide the description

Example:

[ccai_form name="contact-form" button_text="Send Message" show_description="no"]

Viewing Submissions

Go to 'CCAI Forms' > 'Submissions' to view all form submissions. You can filter submissions by form.

Development

This plugin uses Composer for dependency management and follows PSR-4 autoloading standards.

Project Structure

ccai-forms/
├── admin/                  # Admin-specific assets
│   ├── css/                # Admin CSS
│   ├── js/                 # Admin JavaScript
│   └── partials/           # Admin templates
├── languages/              # Translations
├── public/                 # Public-facing assets
│   ├── css/                # Public CSS
│   ├── js/                 # Public JavaScript
│   └── partials/           # Public templates
├── src/                    # PHP source code (PSR-4 autoloaded)
│   ├── Admin/              # Admin functionality
│   ├── Api/                # API integration
│   ├── Database/           # Database operations
│   ├── Form/               # Form management
│   ├── Frontend/           # Frontend functionality
│   ├── I18n.php            # Internationalization
│   ├── Loader.php          # Hook loader
│   └── Plugin.php          # Main plugin class
├── tests/                  # PHPUnit tests
│   ├── Api/                # API tests
│   ├── Form/               # Form tests
│   ├── Frontend/           # Frontend tests
│   ├── Admin/              # Admin tests
│   ├── Unit/               # Unit tests
│   ├── bootstrap.php       # Test bootstrap
│   └── wp-functions.php    # WordPress function mocks
├── vendor/                 # Composer dependencies
├── ccai-forms.php          # Main plugin file
├── composer.json           # Composer configuration
├── phpunit.xml             # PHPUnit configuration
├── LICENSE                 # MIT License
├── README.md               # Plugin documentation
└── README.txt              # WordPress.org readme

Running Tests

To run the PHPUnit tests:

composer test

Code Quality

To check code quality:

composer phpcs

To automatically fix code style issues:

composer phpcbf

Building for Distribution

To build the plugin for distribution:

  1. Install dependencies without dev packages
composer install --no-dev
  1. Create a zip file excluding development files
zip -r ccai-forms.zip . -x "*.git*" "*.github*" "composer.json" "composer.lock" "phpcs.xml" "phpunit.xml" "*.md" "tests/*"

License

This plugin is licensed under the MIT License. See the LICENSE file for details.

Copyright

Copyright (c) 2025 CloudContactAI LLC

About

WordPress Plugin for CloudContactAI, which enables the end user to embed forms in a Page and send SMS messages

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published