=== SandboxPress AI ===
Author: soyeb salar
Tags: dummy content, test data, woocommerce, faker, development
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate bulk dummy content for posts, products, orders, and users — powered by FakerPHP with optional AI integration.

== Description ==

**SandboxPress AI (SBPAI)** is a professional-grade WordPress plugin designed for developers, designers, and QA testers who need realistic, bulk-generated dummy data on development, staging, or demo sites.

Unlike basic lorem-ipsum tools, SBPAI generates structured, relationship-aware content across your entire WordPress installation — including full WooCommerce simulation — using the battle-tested [FakerPHP](https://fakerphp.github.io/) library with an optional AI content layer.

> ⚠️ **This plugin is intended for development/staging environments only.** Do NOT install on live production sites.

---

### 🚀 Core Features

**📝 Content Generation**
- Generate Posts, Pages, and Custom Post Types in bulk
- Assigns randomised authors, categories, tags, and featured images
- **NEW:** Dynamically simulate user comments using your generated Dummy User accounts (complete with their fake avatars!)
- Supports Gutenberg block output structure
- Configurable post status (publish, draft, pending, private)
- Date range controls for backdated content simulation
- Automatic SEO meta population

**🛍️ WooCommerce Automation**
- Generates Simple, Variable, Grouped, and Virtual/Digital products
- Variable products automatically receive randomised attribute sets (Size: XS–XXL, Color, Material) with fully linked WC_Product_Variation children
- Bulk Order generation across all statuses (Completed, Processing, On-Hold, Cancelled)
- Linked Orders: automatically associates generated orders with generated products and users
- Coupon generation with random discount types and usage limits
- WooCommerce Store Setup: configure address, currency, tax, shipping, and payment gateways (COD, BACS, Cheque) from within the plugin
- Setup Wizard bypass so WooCommerce does not redirect you after configuration
- "Clear All Settings" hard reset wipes WooCommerce options cleanly

**👥 User Generator**
- All roles detected automatically — configure count per role individually
- All generated users receive `@yopmail.com` addresses (real inboxes, no sign-up required)
- Shared default password configurable from the UI
- Automatic WooCommerce billing and shipping address population
- Avatar sideloading from external image CDN
- User bio and website URL generation

**🤖 AI Content Integration**
- Connect one Primary AI provider and one Fallback provider
- **Free providers supported:** Groq (LLaMA 3), Google Gemini, Hugging Face, Mistral AI, Cohere
- **Paid providers supported:** OpenAI (GPT-4o Mini), Anthropic Claude, OpenRouter, Together AI, Perplexity
- Test Connection button per provider before saving
- If Primary fails, Fallback is automatically tried; if both fail, FakerPHP generates content locally — generation never stops
- Can be toggled on/off globally from Settings

**📊 Analytics Dashboard**
- Live stat cards: Posts, Products, Orders, Users, Coupons, Media Uploaded, Queue Pending
- **Strict Analytical Accuracy:** Guaranteed zero-overlap mathematical tracking across all post types (no double-counting pages as posts)
- System status checks: Action Scheduler, FakerPHP, WooCommerce, ACF, PHP version
- Quick links to each generation module

**🗂️ Content Management Lists**
- Dedicated list views for generated Posts, WooCommerce Products, and Orders
- Filter by Post Type, Product Type (Simple / Variable / Grouped), or Order Status
- Bulk Delete with native WordPress checkbox selection
- Per-row individual delete links

**⚙️ Settings**
- 22 domain/niche presets (Real Estate, Technology, Fashion, Healthcare, Crypto, Gaming, and more)
- Niche context injected into AI prompts and image search keywords
- **Nuclear Danger Zone:** Not just a delete button. A full-scale data eradication tool that halts all background queues, deletes all data gracefully, and then scrubs the database with raw SQL to destroy any orphaned tracking metadata.

---

### 🔧 How Background Generation Works

All bulk generation jobs are dispatched to **WooCommerce Action Scheduler** (included via Composer). This means:

- The browser never times out on large batches
- Jobs run silently in the background via WP-Cron
- A live polling counter on every page shows how many jobs remain in the queue

---

### 📦 Requirements

| Requirement | Minimum Version |
|---|---|
| WordPress | 6.0+ |
| PHP | 7.4+ |
| WooCommerce *(for WC features)* | 7.0+ |
| FakerPHP *(bundled via Composer)* | 1.24+ |
| Action Scheduler *(bundled)* | 3.6+ |

---

### 🔌 Optional Integrations

- **Advanced Custom Fields (ACF)** — SBPAI will automatically populate registered ACF fields on generated posts if ACF is active
- **WooCommerce HPOS** — Fully compatible with High-Performance Order Storage

---

== Installation ==

= Automatic Installation =

1. In your WordPress admin, go to **Plugins → Add New**
2. Search for **SandboxPress AI**
3. Click **Install Now**, then **Activate**

= Manual Installation =

1. Download the plugin `.zip` file
2. Go to **Plugins → Add New → Upload Plugin**
3. Select the `.zip` file and click **Install Now**
4. Click **Activate Plugin**

= After Activation =

Navigate to **SandboxPress AI** in your WordPress admin sidebar. You will see the following sections:

- **Dashboard** — Live analytics and system status
- **Content** — Generate posts, pages, and CPTs
- **Users** — Configure roles and generate user accounts
- **WooCommerce** — Generate products, orders, and configure your store
- **Settings** — Configure niche, AI providers, and manage data

---

== Frequently Asked Questions ==

= Will this work on my production site? =

**No.** This plugin is strictly for development and staging environments. It is designed to generate large amounts of fake data and does not have safeguards against polluting a live database.

= Do I need WooCommerce installed? =

WooCommerce is only required for the WooCommerce module (Products, Orders, Coupons). The Content and Users modules work on any WordPress installation without WooCommerce.

= Do I need an AI API key? =

No. All AI providers are completely optional. By default, all content is generated locally using FakerPHP which works with zero configuration and zero API cost. AI providers simply enhance the quality of titles and body text.

= What is yopmail.com and why are generated users assigned emails there? =

[Yopmail](https://yopmail.com) is a free, no-signup disposable email service. Any email `anything@yopmail.com` has a working inbox you can visit instantly. This makes it easy to test WooCommerce email flows (order confirmations, password resets) using generated users without needing real email addresses.

= How do I delete all the generated content? =

Go to **Settings → Danger Zone** and click **Delete All Dummy Data**. This permanently removes all posts, users, products, orders, and media that carry the plugin's `_sbpai_` tracking identifiers.

= Can I filter generated content in the admin lists? =

Yes. Each list view (Content, Products, Orders, Users) has a filter dropdown at the top and supports native bulk deletion via checkboxes.

= What happens if the AI provider fails mid-generation? =

The generation chain is: **Primary AI → Fallback AI → FakerPHP**. If both AI providers fail, content is generated locally using FakerPHP. Generation never stops or throws a fatal error.

= Does this support WooCommerce HPOS? =

Yes. Order tracking uses the WooCommerce `WC_Order::update_meta_data()` API which is fully compatible with both legacy Post-based storage and the new High-Performance Order Storage (HPOS/COT).

= What are the default passwords for generated users? =

The default password is configurable from the Users tab before generation. The default value is `Password@123`. The password is also stored per-user in the `_sbpai_default_password` user meta key for reference.

= How do I connect an AI provider? =

1. Go to **Settings → AI Providers**
2. Select your **Primary Provider** from the dropdown (Free or Paid)
3. Paste your API key
4. Click **🔌 Test Connection** to verify it works
5. Click **💾 Save & Activate**
6. Optionally, repeat for a **Fallback Provider**
7. Enable AI generation in **Settings → General** by checking **Use AI for Content**

== Screenshots ==

1. Dashboard of plugin with all details - Displays live analytics count cards for posts, users, products, and orders, along with system environment status checks.
2. Generate Content post tab - Configurator to bulk generate posts, pages, and custom post types with options for categories, featured images, and dates.
3. View All list of fake posts - Interactive dashboard list showing all generated mock posts with author, tags, and options for quick and bulk deletion.
4. User Generation tab - Panel to configure user creation by individual role counts, shared passwords, CDN avatars, and profile details.
5. User Generation list - Management interface displaying generated customer and editor profiles with filtering by role and bulk deletion controls.
6. WooCommerce Product generation tab - Module to generate simple, grouped, variable, and virtual products, including real linked variable attribute sets.
7. WooCommerce Quick store generation tab - Store setup screen to configure mock addresses, local currencies, taxes, and shipping rules to bypass the WC setup wizard.
8. WooCommerce Dummy Product list tab - Dedicated table showing generated catalog products with product type badges, pricing, and bulk delete actions.
9. WooCommerce Order generation tab - Interface to simulate bulk order placement across multiple statuses, linking orders dynamically to existing products and users.
10. Settings General tab for domain choose and AI switch - Settings screen to choose from 22 domain presets (e.g. tech, fashion) and toggle the global AI text generation mode.
11. AI key configuration tab for OpenAI and Groq and choose from list - Key management panel to register primary and fallback LLM API credentials with an inline connection tester.
12. Nuclear Danger Zone tab for delete all fake data - Data eradication console to immediately halt background queues and perform database cleanup of all generated metadata.

---

== Changelog ==

= 1.0.1 =
* **Fix:** Declared compatibility with WooCommerce High-Performance Order Storage (HPOS) and Cart/Checkout Blocks to resolve the "incompatible plugin" admin notice.

= 1.0.0 =
* Initial public release
* Content generation: Posts, Pages, Custom Post Types
* WooCommerce: Simple, Variable, Grouped, Virtual products with real attribute variations
* WooCommerce: Order generation with status randomisation and linked users/products
* WooCommerce: Setup Wizard bypass and Store Setup tab
* WooCommerce: "Clear All Settings" reset utility
* User generation with per-role counts, yopmail addresses, and configurable default password
* AI integration: 10 providers (Groq, Gemini, HuggingFace, Mistral, Cohere, OpenAI, Claude, OpenRouter, Together, Perplexity)
* Primary + Fallback AI chain with automatic FakerPHP fallback
* Analytics dashboard with live stat cards and system status
* Bulk actions and filter dropdowns on all list views
* WooCommerce HPOS-compatible order tracking
* Action Scheduler background queue with live polling indicator
* 22-niche content domain presets
* **Feature:** Added native User Comment simulation. Easily inject random threaded replies onto your dummy posts using the names and fake avatars of your existing generated Dummy Users.
* **Feature:** Nuclear Wipe utility built into Danger Zone. Halts all background Action Scheduler queues instantly, cleanly deletes all WooCommerce and standard posts, and sweeps the database with raw SQL to obliterate orphaned metadata.
* **Security:** Finalised major PHPCS and security hardening sweeps across all views and data controllers.

---

== Upgrade Notice ==

= 1.0.1 =
Fixes WooCommerce "incompatible plugin" notice. No action required.

= 1.0.0 =
Initial release. No upgrade steps required.

---

== License ==

This plugin is licensed under the GPLv2 or later.
https://www.gnu.org/licenses/gpl-2.0.html

---

== Credits ==

- [FakerPHP](https://fakerphp.github.io/) — Fake data generation library (MIT License)
- [WooCommerce Action Scheduler](https://actionscheduler.org/) — Background job processing (GPL-3.0)
- [Yopmail](https://yopmail.com) — Disposable email inboxes used for generated users

== External Services ==

This plugin provides optional integrations with external third-party Artificial Intelligence (AI) API services to generate highly realistic, context-aware dummy text content (such as blog titles, articles, and product descriptions) matching your configured niche. These integrations are entirely optional; by default, all content is generated locally on your server using FakerPHP without connecting to any external services.

If you choose to enable AI content generation, configure a provider, and save a valid API key, the plugin will dispatch remote HTTP POST requests sending context prompts (describing the post type, niche, and text length) to the selected service. No personal user data, site visitor metrics, or sensitive system configurations are ever transmitted.

Below are the 10 optional AI service providers supported by this plugin:

1. OpenAI
* Service Description: Provides AI text generation models (such as GPT-4o Mini) to generate realistic mock text content.
* Data Sent: Dispatches textual context prompts (containing the desired post niche, length, and content type) only when you trigger a bulk content generation process.
* Terms of Service: https://openai.com/policies/terms-of-use
* Privacy Policy: https://openai.com/policies/privacy-policy

2. Google Gemini
* Service Description: Provides Gemini models for realistic content generation.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://policies.google.com/terms
* Privacy Policy: https://policies.google.com/privacy

3. Anthropic Claude
* Service Description: Provides Claude models for realistic content generation.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://www.anthropic.com/legal/consumer-terms
* Privacy Policy: https://www.anthropic.com/legal/privacy

4. Groq
* Service Description: Provides high-performance LLaMA/Mixtral model hosting for realistic content generation.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://groq.com/terms-of-service/
* Privacy Policy: https://groq.com/privacy-policy/

5. Mistral AI
* Service Description: Provides Mistral text generation models for content generation.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://legal.mistral.ai/terms
* Privacy Policy: https://legal.mistral.ai/terms/privacy-policy

6. Hugging Face
* Service Description: Hosts open-source AI models for realistic text generation.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://huggingface.co/terms-of-service
* Privacy Policy: https://huggingface.co/privacy

7. Cohere
* Service Description: Provides text generation models for mock content.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://cohere.com/terms-of-use
* Privacy Policy: https://cohere.com/privacy

8. Together AI
* Service Description: Host of various open source models for rapid text generation.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://www.together.ai/terms-of-service
* Privacy Policy: https://www.together.ai/privacy

9. OpenRouter
* Service Description: Unified API gateway to route generation requests to various LLM models.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://openrouter.ai/terms
* Privacy Policy: https://openrouter.ai/privacy

10. Perplexity
* Service Description: Provides LLM models optimized for generating factual mock text.
* Data Sent: Dispatches textual context prompts only when you trigger a bulk content generation process.
* Terms of Service: https://www.perplexity.ai/hub/legal/terms-of-service
* Privacy Policy: https://www.perplexity.ai/hub/legal/privacy-policy

== User Creation & Sandbox Simulation Notice ==

As a dedicated WooCommerce store simulation and dummy content generation utility, this plugin facilitates the bulk creation of realistic dummy user profiles (with customer, editor, contributor, author, and subscriber roles).

* **Technical Necessity**: Realistic buyer accounts are strictly required by WooCommerce order simulation mechanisms. Without distinct mock users, the simulator cannot build relational mock order datasets, link billing/shipping profiles, populate checkout options, or mock buyer feedback reviews.
* **Security Guardrails**:
- User creation is strictly gated behind administrative authorization checks (`current_user_can('manage_options')`) and secure CSRF nonces.
- All generated users carry unique tracking metadata (`_sbpai_user = '1'`) allowing admins to obliterate them globally at any time using the hard-reset "Danger Zone" option.
- No generated profiles are assigned administrative privileges.
- **IMPORTANT**: This plugin is intended strictly for local development, staging, or private sandboxes. It should never be activated on live production environments.
