Skip to content

Conversation

@shervElmi
Copy link
Contributor

@shervElmi shervElmi commented Jan 12, 2026

Fixes https://github.com/Strategy11/formidable-pro/issues/5794

This PR fixes an issue where hidden column preferences reset when the inbox unread count changes.

Pro PR

Move badge addition after add_menu_page to maintain stable WordPress screen IDs which use sanitize_title($menu_title). Extract badge logic into separate add_menu_badge() method that modifies global $menu array directly instead of concatenating to menu name before registration.
…D conflicts

Stop concatenating unread inbox count to filter hook name which was causing WordPress screen ID mismatches. Use base sanitized menu name only in manage_{screen}_columns filter to maintain stable screen identification.
…n ID conflicts

Stop concatenating unread inbox count to screen ID which was causing WordPress screen ID mismatches. Use base sanitized menu name only in remove_screen_options() and get_screen_id() to maintain stable screen identification.
…en ID conflicts

Stop concatenating unread inbox count to screen ID which was causing WordPress screen ID mismatches. Use base sanitized menu name only in add_list_hooks() and remove_screen_options() to maintain stable screen identification.
Mark FrmEntriesHelper::get_visible_unread_inbox_count() as deprecated and return 0. Remove inbox count calculation logic that was causing WordPress screen ID conflicts by modifying menu names after registration.
@shervElmi shervElmi marked this pull request as ready for review January 12, 2026 18:37
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

Walkthrough

Centralizes admin menu badge logic by adding FrmAppController::add_menu_badge() and refactors menu() to use it. Removes dynamic unread-count suffixes from filter/hook keys and screen-option naming in dashboard, entries, and payments controllers. Deprecates FrmEntriesHelper::get_visible_unread_inbox_count() and returns 0.

Changes

Cohort / File(s) Summary
Menu badge centralization
classes/controllers/FrmAppController.php
Added public static function add_menu_badge() and updated menu() to call it after adding the admin menu item; moves label/badge modification into the new helper. Review: badge retrieval and global $menu mutation.
Dashboard screen keys
classes/controllers/FrmDashboardController.php
Removed dynamic unread-count suffix from the dashboard columns filter key (manage_<menu>_page_formidable-dashboard_columns now static). Review: filter registration key change.
Entries screen & options
classes/controllers/FrmEntriesController.php
Removed unread-count suffix from screen-option comparisons and base column key; remove_screen_options() now compares against sanitized menu name only and now returns $show_screen. Review: screen ID matching and return behavior.
Payments hooks/screen options
stripe/controllers/FrmTransLiteListsController.php
Removed unread-count suffix from payments columns hook name and screen-option comparisons; hook names now use sanitized menu name only. Review: hook names and screen comparisons.
Deprecated unread-count helper
classes/helpers/FrmEntriesHelper.php
Marked get_visible_unread_inbox_count() as deprecated; body now calls _deprecated_function() and returns 0. Review: callers expecting a real count may be affected.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

action: needs qa

Suggested reviewers

  • Crabcyborg
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix hidden column reset when inbox count changes' directly and clearly summarizes the main change: stabilizing screen IDs to prevent column preferences from resetting when inbox counts change.
Description check ✅ Passed The description clearly relates to the changeset, explaining the bug being fixed (hidden column reset when inbox count changes) and referencing the associated issue and related Pro PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a5c292 and 10d5cae.

📒 Files selected for processing (1)
  • classes/controllers/FrmAppController.php
🧰 Additional context used
🧬 Code graph analysis (1)
classes/controllers/FrmAppController.php (3)
classes/controllers/FrmDashboardController.php (1)
  • menu (32-34)
classes/controllers/FrmFormsController.php (1)
  • menu (28-38)
classes/controllers/FrmInboxController.php (2)
  • FrmInboxController (9-118)
  • get_notice_count (21-26)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: PHP 7.4 tests in WP 6.9
  • GitHub Check: PHP 8 tests in WP 6.9
  • GitHub Check: Cypress
🔇 Additional comments (2)
classes/controllers/FrmAppController.php (2)

20-26: Sound approach for stabilizing screen IDs.

The separation of badge addition from add_menu_page() correctly addresses the root cause. WordPress generates screen IDs via sanitize_title($menu_title), so keeping the menu title clean during registration ensures stable IDs regardless of inbox count changes.

Minor: The comment on line 22 could be clearer with punctuation: "...stable they use" or "...stable as they use".


35-50: LGTM!

The implementation correctly:

  1. Retrieves the badge HTML with proper sanitization via wp_kses_post()
  2. Short-circuits when there's no badge to add
  3. Locates the Formidable menu item by slug (index 2 in WordPress menu array)
  4. Appends the badge to the menu title without affecting the screen ID

Note: The @since x.x placeholder on line 31 should be updated to the actual version before release.


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.

@shervElmi shervElmi requested a review from Crabcyborg January 12, 2026 18:40
@Crabcyborg Crabcyborg added this to the 6.28 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants