Skip to content

Add 'General' category for registration forms#1822

Open
arifulhoque7 wants to merge 2 commits intoweDevsOfficial:developfrom
arifulhoque7:enhancement/template-modal-general-category
Open

Add 'General' category for registration forms#1822
arifulhoque7 wants to merge 2 commits intoweDevsOfficial:developfrom
arifulhoque7:enhancement/template-modal-general-category

Conversation

@arifulhoque7
Copy link
Contributor

@arifulhoque7 arifulhoque7 commented Feb 26, 2026

Introduce a new 'general' category to the profile/registration form categories in modal-v4.2.php. The category includes the label 'General' (text domain 'wp-user-frontend') and keywords ['simple', 'signup', 'blog author'] to help surface simple/signup/blog-author templates in the modal.

Related PRO PR

Summary by CodeRabbit

  • New Features
    • Added a new "General" category option for profile and registration forms to support simple signups and blog author profiles.
    • Restored an active "Community" category option for profile and registration forms to allow community member categorization.

Introduce a new 'general' category to the profile/registration form categories in modal-v4.2.php. The category includes the label 'General' (text domain 'wp-user-frontend') and keywords ['simple', 'signup', 'blog author'] to help surface simple/signup/blog-author templates in the modal.
@arifulhoque7 arifulhoque7 self-assigned this Feb 26, 2026
@arifulhoque7 arifulhoque7 requested a review from sapayth February 26, 2026 05:08
@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

Walkthrough

Added a new "general" category and re-enabled the "community" category in the registration/profile form categories within the modal configuration, updating labels and keywords and affecting the conditional set of categories used for registration/profile forms.

Changes

Cohort / File(s) Summary
Form Categories Update
includes/Admin/template-parts/modal-v4.2.php
Added a new general category (label: "General", keywords: ["simple","signup","blog author"]) and re-enabled the previously commented community category (label: "Community", keywords: ["community member"]); these changes adjust the categories available for registration/profile form conditionals.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • sapayth

Poem

🐰 I hopped into templates, tidy and spry,
Planted "General" where new templates lie,
Brought back "Community," a welcomed friend,
Categories joined — a small hopping trend! 🥕

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately reflects the primary change: adding a 'General' category for registration forms, which is the main focus of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@arifulhoque7 arifulhoque7 added needs: dev review This PR needs review by a developer needs: testing labels Feb 26, 2026
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@includes/Admin/template-parts/modal-v4.2.php`:
- Around line 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).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fe256a and e95abf7.

📒 Files selected for processing (1)
  • includes/Admin/template-parts/modal-v4.2.php

Comment on lines +41 to +44
'general' => [
'label' => __( 'General', 'wp-user-frontend' ),
'keywords' => [ 'simple', 'signup', 'blog author' ],
],
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).

Uncommented the 'community' entry in modal-v4.2.php and set its keywords to ['community member'] to improve discoverability in the admin modal's block selector. Previously this block was commented out with no keywords.
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.

♻️ Duplicate comments (1)
includes/Admin/template-parts/modal-v4.2.php (1)

41-44: ⚠️ Potential issue | 🟠 Major

Default category wiring is still inconsistent with the new general slug.

Line 41 introduces general, but fallback assignments still use registration (Line 93, Line 196, Line 212). That slug is absent from $categories, so default/blank/AI templates can bypass expected counts and filters.

🔧 Proposed fix
-        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 code
introduces a new category slug 'general' in the $categories array but other
parts still fall back to 'registration', causing mismatches; update all
fallback/default assignments that reference 'registration' (e.g., the
default/blank/AI template assignment logic and any variables or functions that
choose a category) to use 'general' instead so the category lookups and counts
use the newly declared 'general' slug consistently (search for occurrences of
'registration' in the modal-v4.2.php template logic and replace them with
'general' where they serve as defaults/fallbacks).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@includes/Admin/template-parts/modal-v4.2.php`:
- Around line 41-44: The code introduces a new category slug 'general' in the
$categories array but other parts still fall back to 'registration', causing
mismatches; update all fallback/default assignments that reference
'registration' (e.g., the default/blank/AI template assignment logic and any
variables or functions that choose a category) to use 'general' instead so the
category lookups and counts use the newly declared 'general' slug consistently
(search for occurrences of 'registration' in the modal-v4.2.php template logic
and replace them with 'general' where they serve as defaults/fallbacks).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e95abf7 and 3942b25.

📒 Files selected for processing (1)
  • includes/Admin/template-parts/modal-v4.2.php

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant