Skip to content

Conversation

@arifulhoque7
Copy link
Contributor

@arifulhoque7 arifulhoque7 commented Nov 28, 2025

Close issue

AI Form Builder with Pre-built Integration Templates for WooCommerce, EDD, and The Events Calendar


📋 Overview

This feature adds integration-specific AI form generation capabilities to the WP User Frontend AI Form Builder, enabling users to create specialized forms for popular WordPress plugins with pre-configured field structures and intelligent prompts.


✨ Key Features

🎯 Integration Selector UI

  • Added dropdown selector in the AI Form Builder input stage (post forms only)
  • Users can choose from:
    • Regular Form (default)
    • WooCommerce Product Form
    • Easy Digital Downloads Product Form
    • The Events Calendar Event Form
  • Dynamic integration detection based on active plugins
  • Graceful fallback when integrations are not available

🤖 Specialized AI Prompts

Added three comprehensive prompt templates with precise field structures:

  1. wpuf-ai-prompt-woocommerce.md (463 lines)

    • Complete WooCommerce product submission form structure
    • Includes: Product Name, Description, Pricing, Gallery, Catalog Visibility, Reviews
    • Sets post_type: "product" automatically
  2. wpuf-ai-prompt-edd.md (325 lines)

    • Easy Digital Downloads product form template
    • Includes: Download Name, Description, Pricing, Files, Categories
    • Sets post_type: "download" automatically
  3. wpuf-ai-prompt-events-calendar.md (408 lines)

    • The Events Calendar event submission form
    • Includes: Event Title, Description, Date/Time, Venue, Organizer
    • Sets post_type: "tribe_events" automatically

🔌 Backend API

  • New REST endpoint: GET /wpuf/v1/ai-form-builder/integrations
  • Returns available integrations based on active plugins
  • Integration detection logic in AI_Manager.php
  • Integration-specific prompt loading in FormGenerator.php

📁 Modified Files

File | Changes | Lines -- | -- | -- assets/js/components/AIFormBuilder.vue | Integration state management | +42 assets/js/components/FormInputStage.vue | Integration selector UI | +167 includes/AI/FormGenerator.php | Integration-specific prompts | +53 includes/AI/Form_Builder.php | Integration context passing | +15 includes/AI/RestController.php | Integrations endpoint | +86 includes/AI_Manager.php | Integration detection | +11

New Files:

  • includes/AI/wpuf-ai-prompt-woocommerce.md (+463 lines)
  • includes/AI/wpuf-ai-prompt-edd.md (+325 lines)
  • includes/AI/wpuf-ai-prompt-events-calendar.md (+408 lines)

Total: +1,548 lines, -22 lines


🎨 User Experience

Before:

  • Users had to manually describe WooCommerce/EDD/Event fields
  • No guidance on required WooCommerce meta fields
  • Generic AI prompts for all form types

After:

  • One-click selection of integration type
  • Pre-configured field structures matching plugin standards
  • Context-aware AI that understands WooCommerce _regular_price, EDD pricing tiers, Event date/time fields
  • Automatic post_type configuration

🌍 Multilingual Support

All prompts include:

  • Multi-language field label generation
  • Support for RTL languages (Arabic, Hebrew)
  • Language detection from user input
  • Automatic label translation when target language is specified

🔧 Technical Details

Integration Detection:

// WooCommerce
class_exists('WooCommerce')

// Easy Digital Downloads
class_exists('Easy_Digital_Downloads')

// The Events Calendar
class_exists('Tribe__Events__Main')

API Response Format:

{
"success": true,
"integrations": [
{
"id": "woocommerce",
"label": "WooCommerce Product Form",
"active": true
}
]
}

✅ Testing Checklist

  •  Integration selector shows only when plugins are active
  •  AI generates correct field structure for each integration
  •  post_type is set correctly in form settings
  •  WooCommerce meta fields use is_meta: "yes"
  •  Event dates use proper date/time pickers
  •  Multilingual labels work correctly
  •  Fallback to regular form when no integration selected
  •  REST API endpoint returns correct integrations

🚀 Ready for Review

This feature significantly enhances the AI Form Builder by providing intelligent, plugin-specific form generation that reduces setup time and ensures compatibility with popular WordPress eCommerce and events plugins.

 

Branch: feat/integration-specific-ai-builder
Base: develop
Commits: 1 feature commit
Status: ✅ Ready for review


Summary by CodeRabbit

Release Notes

  • New Features

    • Added integration support for AI form generation (WooCommerce, Easy Digital Downloads, The Events Calendar).
    • Introduced integration selector UI for post forms to choose specific integrations or regular forms.
    • New REST API endpoint to retrieve available integrations based on form type.
    • Enhanced AI prompts with integration-specific templates and instructions for each supported platform.
  • Improvements

    • Improved form settings by merging AI-provided values with defaults.
    • Enhanced error handling with structured error messages from API responses.

✏️ Tip: You can customize this high-level summary in your review settings.

@arifulhoque7 arifulhoque7 self-assigned this Nov 28, 2025
@arifulhoque7 arifulhoque7 added needs: testing needs: dev review This PR needs review by a developer labels Nov 28, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Walkthrough

This PR adds integration support to the AI Form Builder, allowing users to select from available integrations (WooCommerce, EDD, Events Calendar) when generating forms. Changes include frontend UI for integration selection, REST endpoints to fetch available integrations, integration-specific system prompts, and enhanced form settings management.

Changes

Cohort / File(s) Summary
Frontend Integration Selection
assets/js/components/AIFormBuilder.vue, assets/js/components/FormInputStage.vue
Added selectedIntegration state tracking in parent; introduced Integration Selector UI and initialIntegration prop in child with onIntegrationChange handler; extended generation payload to include integration data.
REST API Enhancement
includes/AI/RestController.php
Added integration parameter to generate endpoint and new GET route for /ai-form-builder/integrations endpoint; implemented get_integrations method to return available integrations filtered by form type and plugin activation status.
Backend Integration Logic
includes/AI/FormGenerator.php, includes/AI/Form_Builder.php
Enhanced get_system_prompt to route to integration-specific prompt files (woocommerce, edd, events_calendar) with fallback; introduced merge_form_settings helper to compose AI-provided settings with defaults.
Integration-Specific Prompts
includes/AI/wpuf-ai-prompt-woocommerce.md, includes/AI/wpuf-ai-prompt-edd.md, includes/AI/wpuf-ai-prompt-events-calendar.md
Added three comprehensive prompt files defining integration-specific form structures, field templates, taxonomies, meta keys, and response formats for WooCommerce products, EDD downloads, and Events Calendar events.
Frontend Context
includes/AI_Manager.php
Added runtime form_type determination in admin context (mapped to 'profile' or 'post' based on page) and exposed via wpufAIFormBuilder localization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Integration parameter flow: Verify selectedIntegration propagates correctly from Vue component through FormInputStage, API call, backend handler, and into system prompt selection
  • REST endpoint correctness: Validate the new /ai-form-builder/integrations endpoint properly detects installed plugins and filters available integrations by form type
  • Prompt file completeness: Review the three new integration-specific prompt files for consistency in structure, mandatory field definitions, and meta-key conventions
  • Form settings merge logic: Confirm merge_form_settings correctly prioritizes AI-provided values over defaults without losing existing configuration

Possibly related PRs

Suggested reviewers

  • sapayth

Poem

🐰 With integrations now in sight,
Forms connect to plugins bright,
WooCommerce, EDD, events align,
Each prompt a thread, each function fine,
The builder hops through choices new!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat/integration specific ai builder' clearly summarizes the main change: adding integration-specific AI form generation capabilities to the WP User Frontend AI Form Builder.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
includes/AI_Manager.php (1)

106-114: Consider sanitizing $_GET['page'] input.

While this code runs in an authenticated admin context and the value is only used for comparison (not stored or output), it's good practice to sanitize superglobal access. The static analysis tool flagged this for nonce verification, but since this is just determining context during script enqueueing (not processing a form submission), nonce verification isn't strictly necessary here.

Apply this diff for improved defensive coding:

         // Determine form type based on current admin page
         $form_type = 'post'; // Default to post
         if ( isset( $_GET['page'] ) ) {
-            if ( 'wpuf-profile-forms' === $_GET['page'] ) {
+            $page = sanitize_text_field( wp_unslash( $_GET['page'] ) );
+            if ( 'wpuf-profile-forms' === $page ) {
                 $form_type = 'profile';
-            } elseif ( 'wpuf-post-forms' === $_GET['page'] ) {
+            } elseif ( 'wpuf-post-forms' === $page ) {
                 $form_type = 'post';
             }
         }
includes/AI/RestController.php (2)

489-496: Remove unused loop variable $key.

The static analysis correctly identified that $key is unused in the foreach loop.

Apply this diff:

         // Filter integrations based on form type and enabled status
         $available_integrations = [];
-        foreach ( $all_integrations as $key => $integration ) {
+        foreach ( $all_integrations as $integration ) {
             // Only include if enabled and supports the current form type
             if ( $integration['enabled'] && in_array( $form_type, $integration['form_types'], true ) ) {
                 $available_integrations[] = $integration;
             }
         }

462-487: Consider caching integration availability checks.

The class_exists checks for WooCommerce, EDD, and Events Calendar run on every API request. While these are fast operations, consider caching the result using a transient if this endpoint is called frequently.

This is a minor optimization that could be deferred. The current implementation is functionally correct.

assets/js/components/FormInputStage.vue (2)

271-342: Consider extracting default prompts to reduce duplication.

The default post form prompts (lines 323-340) duplicate the initial prompts in data() (lines 148-165). Consider extracting to a constant or shared method for maintainability.

// At the top of the script, before export default:
const DEFAULT_POST_PROMPTS = {
    templates: [
        { id: 'paid_guest_post', label: 'Paid Guest Post' },
        // ... other templates
    ],
    instructions: {
        paid_guest_post: 'Create a Paid Guest Post submission form...',
        // ... other instructions
    }
};

// Then use in both data() and updatePromptTemplates():
// this.promptTemplates = DEFAULT_POST_PROMPTS.templates.map(t => ({...t, label: this.__(t.label, 'wp-user-frontend')}));

187-190: Consider using loadingIntegrations state in the UI.

The loadingIntegrations state is tracked but not reflected in the UI. Consider showing a loading indicator or disabling the select while loading.

 <select
     v-model="selectedIntegration"
+    :disabled="loadingIntegrations"
     class="..."
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 47b6597 and ce96227.

📒 Files selected for processing (9)
  • assets/js/components/AIFormBuilder.vue (4 hunks)
  • assets/js/components/FormInputStage.vue (5 hunks)
  • includes/AI/FormGenerator.php (2 hunks)
  • includes/AI/Form_Builder.php (1 hunks)
  • includes/AI/RestController.php (5 hunks)
  • includes/AI/wpuf-ai-prompt-edd.md (1 hunks)
  • includes/AI/wpuf-ai-prompt-events-calendar.md (1 hunks)
  • includes/AI/wpuf-ai-prompt-woocommerce.md (1 hunks)
  • includes/AI_Manager.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
includes/AI/FormGenerator.php (1)
wpuf-functions.php (1)
  • wpuf_is_pro_active (4988-4990)
🪛 GitHub Check: Run PHPCS inspection
includes/AI_Manager.php

[warning] 111-111:
Processing form data without nonce verification.


[warning] 109-109:
Processing form data without nonce verification.


[warning] 108-108:
Processing form data without nonce verification.

🪛 LanguageTool
includes/AI/wpuf-ai-prompt-woocommerce.md

[uncategorized] ~423-~423: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...ur form" or ANY other text - DO NOT use markdown code blocks (no ```) - DO NOT add expla...

(MARKDOWN_NNP)

includes/AI/wpuf-ai-prompt-events-calendar.md

[grammar] ~143-~143: Use a hyphen to join words.
Context: ...y-mm-dd", "time": "yes" } ### All Day Event:json { "template": "chec...

(QB_NEW_EN_HYPHEN)


[uncategorized] ~365-~365: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...ur form" or ANY other text - DO NOT use markdown code blocks (no ```) - DO NOT add expla...

(MARKDOWN_NNP)

includes/AI/wpuf-ai-prompt-edd.md

[uncategorized] ~282-~282: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...ur form" or ANY other text - DO NOT use markdown code blocks (no ```) - DO NOT add expla...

(MARKDOWN_NNP)

🪛 PHPMD (2.15.0)
includes/AI/RestController.php

491-491: Avoid unused local variables such as '$key'. (undefined)

(UnusedLocalVariable)

🔇 Additional comments (19)
includes/AI_Manager.php (1)

116-129: LGTM!

The formType is correctly added to the localization data, enabling the frontend to determine which integrations to display based on the current form context.

includes/AI/Form_Builder.php (2)

78-78: LGTM!

The call to merge_form_settings correctly passes the AI settings with a null-coalescing fallback to an empty array, ensuring the merge logic handles both present and absent settings gracefully.


82-93: LGTM!

The merge_form_settings helper is well-implemented. Using array_merge correctly gives AI-provided settings precedence over defaults. This approach is clean and follows the single responsibility principle.

includes/AI/FormGenerator.php (2)

708-709: Consider using the existing helper function consistently.

The code uses function_exists( 'wpuf_is_pro_active' ) && wpuf_is_pro_active() here, which is correct. This pattern is safe since the function is defined in wpuf-functions.php. The defensive check is appropriate.


742-765: LGTM!

The Pro version guidance is correctly scoped to integration forms only, providing context-aware field recommendations. The WooCommerce and Events Calendar specific notes help the AI generate appropriate field types based on the plugin version.

includes/AI/wpuf-ai-prompt-woocommerce.md (3)

34-54: LGTM!

The form_settings with post_type: "product" is correctly documented as mandatory for WooCommerce forms. The example JSON structure is clear and matches the expected format.


56-64: Good emphasis on WooCommerce-specific taxonomies.

The critical notes about using product_cat and product_tag instead of generic WordPress taxonomies are important for correct form generation. This guidance will help prevent common integration issues.


265-275: Based on the verification attempt, I've encountered limitations in accessing the repository directly. However, the web search results provide some insight:

The web search indicates that numeric_text_field is available in both WP User Frontend and WP User Frontend Pro, suggesting it may not be an exclusive Pro feature. However, the results are somewhat ambiguous about the distinction between free and Pro availability.

Since I cannot access the file to verify:

  1. Whether the prompt header actually marks this as a Pro field
  2. How the pricing field documentation handles Pro guidance
  3. The document's overall scope and audience

I cannot definitively confirm or refute the original review comment's concern.


Manual verification is needed to confirm whether numeric_text_field for Stock Quantity is documented as Pro-only and whether comparable Pro-feature guidance exists for other fields in this prompt file.

includes/AI/RestController.php (3)

101-107: LGTM!

The integration parameter is properly defined with validation (enum), sanitization, and sensible defaults. The empty string in the enum allows for "no integration" selection.


145-159: LGTM!

The new /integrations endpoint is correctly registered with proper permission callback and form_type filtering parameter. The enum validation ensures only valid form types are accepted.


305-308: LGTM!

The integration is correctly propagated into the conversation context when provided, enabling the FormGenerator to select the appropriate integration-specific prompt.

includes/AI/wpuf-ai-prompt-edd.md (1)

1-325: LGTM! Comprehensive EDD prompt template.

The prompt correctly enforces EDD-specific requirements including post_type: "download", EDD taxonomies (download_category, download_tag), and meta fields (edd_price, edd_download_files, edd_product_notes). The JSON examples are valid and the documentation is thorough.

assets/js/components/AIFormBuilder.vue (2)

8-14: LGTM! Integration prop and event handling properly wired.

The bi-directional binding for selectedIntegration between parent and child components is correctly implemented using the prop and event pattern.


115-143: LGTM! API call correctly handles optional integration parameter.

The integration parameter is conditionally added to the request body only when provided, maintaining backward compatibility.

includes/AI/wpuf-ai-prompt-events-calendar.md (1)

1-53: Well-structured Events Calendar prompt template.

The prompt correctly enforces TEC-specific requirements including post_type: "tribe_events", proper taxonomy usage (tribe_events_cat), and meta field conventions with _Event prefix.

assets/js/components/FormInputStage.vue (4)

30-53: LGTM! Integration selector UI implementation.

The selector is conditionally rendered only for post forms with available integrations, uses appropriate form styling, and includes helpful description text.


223-255: LGTM! Integration fetching with proper error handling.

The fetch logic correctly handles the REST API call with appropriate headers, checks response status, and gracefully handles errors without breaking the UI.


257-269: LGTM! Clean state management on integration change.

Properly clears prompt selection and form description when integration changes, ensuring a clean slate for the new integration's prompts.


364-372: LGTM! Generation payload includes integration.

The start-generation event correctly includes the selected integration alongside the description and prompt.

Comment on lines +705 to 731
// Get integration type from context if provided
$integration = $context['integration'] ?? '';

// Check if Pro is active using the proper function
$is_pro_active = function_exists( 'wpuf_is_pro_active' ) && wpuf_is_pro_active();

// Determine which prompt file to use based on form type and integration
if ( 'profile' === $form_type || 'registration' === $form_type ) {
// Registration/Profile form prompt - USE MINIMAL REGISTRATION PROMPT
// Registration/Profile form - use registration prompt
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt-registration.md';
} else {
// Post form prompt - USE MINIMAL PROMPT
} elseif ( 'post' === $form_type && ! empty( $integration ) ) {
// Post form WITH integration - use integration-specific prompts
$integration_prompts = [
'woocommerce' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-woocommerce.md',
'edd' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-edd.md',
'events_calendar' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-events-calendar.md',
];

// Use integration prompt if available, fallback to minimal prompt
if ( isset( $integration_prompts[ $integration ] ) && file_exists( $integration_prompts[ $integration ] ) ) {
$prompt_file = $integration_prompts[ $integration ];
} else {
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
}
} elseif ( 'post' === $form_type && empty( $integration ) ) {
// Post form WITHOUT integration - use minimal prompt
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Potential uninitialized variable if form_type has unexpected value.

The conditional logic covers profile, registration, and post form types, but if $form_type is something else (e.g., an empty string or unexpected value), $prompt_file would be uninitialized, causing an error at line 735.

Consider adding a fallback:

         } elseif ( 'post' === $form_type && empty( $integration ) ) {
             // Post form WITHOUT integration - use minimal prompt
             $prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
+        } else {
+            // Fallback for any unexpected form_type
+            $prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Get integration type from context if provided
$integration = $context['integration'] ?? '';
// Check if Pro is active using the proper function
$is_pro_active = function_exists( 'wpuf_is_pro_active' ) && wpuf_is_pro_active();
// Determine which prompt file to use based on form type and integration
if ( 'profile' === $form_type || 'registration' === $form_type ) {
// Registration/Profile form prompt - USE MINIMAL REGISTRATION PROMPT
// Registration/Profile form - use registration prompt
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt-registration.md';
} else {
// Post form prompt - USE MINIMAL PROMPT
} elseif ( 'post' === $form_type && ! empty( $integration ) ) {
// Post form WITH integration - use integration-specific prompts
$integration_prompts = [
'woocommerce' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-woocommerce.md',
'edd' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-edd.md',
'events_calendar' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-events-calendar.md',
];
// Use integration prompt if available, fallback to minimal prompt
if ( isset( $integration_prompts[ $integration ] ) && file_exists( $integration_prompts[ $integration ] ) ) {
$prompt_file = $integration_prompts[ $integration ];
} else {
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
}
} elseif ( 'post' === $form_type && empty( $integration ) ) {
// Post form WITHOUT integration - use minimal prompt
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
// Get integration type from context if provided
$integration = $context['integration'] ?? '';
// Check if Pro is active using the proper function
$is_pro_active = function_exists( 'wpuf_is_pro_active' ) && wpuf_is_pro_active();
// Determine which prompt file to use based on form type and integration
if ( 'profile' === $form_type || 'registration' === $form_type ) {
// Registration/Profile form - use registration prompt
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt-registration.md';
} elseif ( 'post' === $form_type && ! empty( $integration ) ) {
// Post form WITH integration - use integration-specific prompts
$integration_prompts = [
'woocommerce' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-woocommerce.md',
'edd' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-edd.md',
'events_calendar' => WPUF_ROOT . '/includes/AI/wpuf-ai-prompt-events-calendar.md',
];
// Use integration prompt if available, fallback to minimal prompt
if ( isset( $integration_prompts[ $integration ] ) && file_exists( $integration_prompts[ $integration ] ) ) {
$prompt_file = $integration_prompts[ $integration ];
} else {
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
}
} elseif ( 'post' === $form_type && empty( $integration ) ) {
// Post form WITHOUT integration - use minimal prompt
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
} else {
// Fallback for any unexpected form_type
$prompt_file = WPUF_ROOT . '/includes/AI/wpuf-ai-minimal-prompt.md';
}
🤖 Prompt for AI Agents
In includes/AI/FormGenerator.php around lines 705 to 731, the conditional sets
$prompt_file only for 'profile', 'registration', and 'post' cases, leaving
$prompt_file uninitialized for any other $form_type; add a final fallback branch
or initialize $prompt_file before the condition to a sensible default (e.g., the
minimal prompt path) so $prompt_file is always defined, and ensure any
file_exists checks still apply when using the fallback.

Comment on lines +236 to +242
```json
### Event Address:
```json
{
"template": "text_field",
"label": "Event Address",
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix malformed JSON example - appears to be a copy-paste error.

This section has a formatting issue with nested markdown code blocks and an incomplete JSON example. The "Event Address" field example is truncated.

Apply this diff to fix the malformed section:

-```json
-### Event Address:
-```json
-{
-  "template": "text_field",
-  "label": "Event Address",
-```
+### Event Address:
+```json
+{
+  "template": "text_field",
+  "label": "Event Address",
+  "name": "_EventAddress",
+  "is_meta": "yes",
+  "placeholder": "Enter event address"
+}
+```
🤖 Prompt for AI Agents
In includes/AI/wpuf-ai-prompt-events-calendar.md around lines 236 to 242, the
Event Address example contains a malformed/truncated JSON block and
nested/missing code fences; replace the broken snippet with a well-formed JSON
code block that includes the full example fields (template, label, name,
is_meta, placeholder) and ensure the code block opens with ```json and closes
with ``` so the example renders correctly.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Rubaiyat-E-Mohammad
Copy link
Contributor

@arifulhoque7 vai

  • Issue 1:

2 fields are missing for all kind of woocommerce form
image

  • Issues 2

2 fields are missing for digital product form
image

  • Issue 3

While regenerating form, it's not loading woocommerce or edd templates automatically as pre-selected

Screen.Recording.2025-12-02.at.4.08.23.PM.mov
  • Issue 4

2 fields are missing for digital downloads form
image

  • Issue 5

Unnecessary field (product tag) for product form according to manual woo tmplate creation
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug needs: dev review This PR needs review by a developer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants