Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions includes/Admin/template-parts/modal-v4.2.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ function wpuf_check_ai_configuration() {
if ( strpos( strtolower( $form_type ), 'registration' ) !== false || strpos( strtolower( $form_type ), 'profile' ) !== false ) {
// Profile/Registration form categories
$categories = [
'general' => [
'label' => __( 'General', 'wp-user-frontend' ),
'keywords' => [ 'simple', 'signup', 'blog author' ],
],
Comment on lines +41 to +44
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Wire general as the actual default registration/profile category.

After introducing general (Line 41), fallback/category assignment still uses registration (Line 93, Line 196, Line 212). That slug is not in $categories, so counts and filters become inconsistent for uncategorized/blank/AI templates.

🔧 Proposed fix
--- a/includes/Admin/template-parts/modal-v4.2.php
+++ b/includes/Admin/template-parts/modal-v4.2.php
@@
-        if ( strpos( strtolower( $form_type ), 'registration' ) !== false || strpos( strtolower( $form_type ), 'profile' ) !== false ) {
-            return 'registration';
+        if ( strpos( strtolower( $form_type ), 'registration' ) !== false || strpos( strtolower( $form_type ), 'profile' ) !== false ) {
+            return 'general';
         } else {
             return 'post';
         }
@@
-$blank_form_category = strpos( strtolower( $form_type ), 'registration' ) !== false || strpos( strtolower( $form_type ), 'profile' ) !== false ? 'registration' : 'post';
+$blank_form_category = strpos( strtolower( $form_type ), 'registration' ) !== false || strpos( strtolower( $form_type ), 'profile' ) !== false ? 'general' : 'post';
@@
-$ai_form_category = $is_post_form ? 'post' : 'registration';
+$ai_form_category = $is_post_form ? 'post' : 'general';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@includes/Admin/template-parts/modal-v4.2.php` around lines 41 - 44, The
default category slug was added as 'general' but fallback/category assignments
still use 'registration', causing mismatched counts/filters; update all places
that assign a default/fallback category (where $categories is used and where
fallback variables or assignments reference 'registration') to use 'general'
instead, or implement a conditional that if the chosen slug is not in
$categories it falls back to 'general' (adjust the fallback logic around the
category assignment code that currently references 'registration' so it
consistently uses the 'general' slug).

'ecommerce' => [
'label' => __( 'E-commerce', 'wp-user-frontend' ),
'keywords' => [ 'vendor', 'marketplace', 'product' ],
Expand All @@ -46,10 +50,10 @@ function wpuf_check_ai_configuration() {
'label' => __( 'Membership', 'wp-user-frontend' ),
'keywords' => [ 'membership' ],
],
// 'community' => [
// 'label' => __( 'Community', 'wp-user-frontend' ),
// 'keywords' => [],
// ],
'community' => [
'label' => __( 'Community', 'wp-user-frontend' ),
'keywords' => [ 'community member' ],
],
// 'associations' => [
// 'label' => __( 'Associations', 'wp-user-frontend' ),
// 'keywords' => [],
Expand Down
Loading