Skip to content

Fix hidden column reset when inbox count changes#2777

Open
shervElmi wants to merge 9 commits into
masterfrom
fix/hidden-columns-stable-screen-id
Open

Fix hidden column reset when inbox count changes#2777
shervElmi wants to merge 9 commits into
masterfrom
fix/hidden-columns-stable-screen-id

Conversation

@shervElmi
Copy link
Copy Markdown
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

Summary by CodeRabbit

  • Refactor

    • Improved menu badge handling and display logic in admin interface
    • Simplified dashboard and entries screen options filter registration
    • Standardized filter hook naming patterns across controllers
  • Deprecation

    • Deprecated unread inbox count retrieval helper method

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
Copy Markdown
Contributor

coderabbitai Bot commented Jan 12, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c3290d3e-070a-4963-84b2-76acf9b658f4

📥 Commits

Reviewing files that changed from the base of the PR and between 10d5cae and 5f217d5.

📒 Files selected for processing (4)
  • classes/controllers/FrmAppController.php
  • classes/controllers/FrmDashboardController.php
  • classes/controllers/FrmEntriesController.php
  • classes/helpers/FrmEntriesHelper.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • classes/controllers/FrmDashboardController.php
  • classes/helpers/FrmEntriesHelper.php

📝 Walkthrough

Walkthrough

Centralizes admin menu badge logic into FrmAppController::add_menu_badge(), removes dynamic unread-count suffixes from hook/screen identifiers in dashboard, entries, and payments controllers, and deprecates FrmEntriesHelper::get_visible_unread_inbox_count() which now returns 0.

Changes

Menu badge centralization and suffix removal

Layer / File(s) Summary
Centralize menu badge
classes/controllers/FrmAppController.php
Added public static function add_menu_badge() and updated menu() to call it after adding the admin menu item; badge lookup and global $menu mutation moved into the helper.
Dashboard hook key staticization
classes/controllers/FrmDashboardController.php
Dashboard columns filter now registers as manage_<menu_name>_page_formidable-dashboard_columns without an unread-count suffix.
Entries screen & column key
classes/controllers/FrmEntriesController.php
Removed unread-count suffix from remove_screen_options() screen id comparison and from base_column_key(); remove_screen_options() now returns $show_screen when appropriate.
Deprecated unread-count helper
classes/helpers/FrmEntriesHelper.php
get_visible_unread_inbox_count() marked @deprecated, now calls _deprecated_function() and returns 0.
Payments hooks/screen options
stripe/controllers/FrmTransLiteListsController.php
Removed unread-count suffix from payments columns hook name and screen-option comparisons; hook names use sanitized menu name only. (change summarized from PR metadata)

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

action: needs qa

Suggested reviewers

  • Crabcyborg

"A rabbit's note on menus, shiny and bright,
I hopped through code in the quiet night.
Badges now tidy, suffixes gone—hip hooray! 🥕
I twitched my nose and hopped away,
Leaving menus neat for the morning light."

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix hidden column reset when inbox count changes' accurately describes the core issue being resolved in the PR—stabilizing screen IDs so hidden column preferences persist when inbox counts change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hidden-columns-stable-screen-id

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
@Crabcyborg Crabcyborg modified the milestones: 6.28, 6.29 Feb 12, 2026
@Crabcyborg Crabcyborg modified the milestones: 6.29, 6.30 Mar 9, 2026
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg left a comment

Choose a reason for hiding this comment

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

I think this should be good.

We'll likely lose some settings for people who were at a certain inbox number, but it's probably not worth any extra work trying to pull the last setting they had.

🚀

@Crabcyborg
Copy link
Copy Markdown
Contributor

Actually, I'm going to hold it here.

It looks like get_visible_unread_inbox_count is also called in the coupons add-on.

@Crabcyborg Crabcyborg removed this from the 6.32 milestone Jun 3, 2026
@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Jun 3, 2026

DeepSource Code Review

We reviewed changes in 0c23257...5f217d5 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Jun 3, 2026 3:57p.m. Review ↗
JavaScript Jun 3, 2026 3:57p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

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.

2 participants