Skip to content

[6.2] [AI] Backend: Save column visibility preferences per user account in list views#23

Open
MacJoom wants to merge 9 commits into6.1-devfrom
feature/persist-admin-column-visibility
Open

[6.2] [AI] Backend: Save column visibility preferences per user account in list views#23
MacJoom wants to merge 9 commits into6.1-devfrom
feature/persist-admin-column-visibility

Conversation

@MacJoom
Copy link
Copy Markdown
Owner

@MacJoom MacJoom commented Mar 1, 2026

Adds plg_system_usercolumns (system plugin) that stores each logged-in user's hidden-column preferences in #__users.params (key: hidden_tablecolumns) - only active in the backend. The table-columns.es6.js saveState() now POSTs to com_ajax on every toggle (fire-and-forget), and loadState() reads server-injected state first so preferences follow the user across browsers and sessions, falling back to localStorage for guests and anonymous users.

Pull Request resolves # .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

  • build/media_source/system/js/table-columns.es6.js
    • saveState() now additionally POSTs the hidden-column list to the server
      via com_ajax (fire-and-forget, no UX impact)
    • loadState() checks server-injected state first (key: table.columns.state);
      falls back to localStorage for guests
  • plugins/system/usercolumns/ — new system plugin plg_system_usercolumns
    • onBeforeRender: reads tablecolumns from #__users.params and injects it
      into the page via Document::addScriptOptions() — no extra request needed
    • onAjaxUsercolumns: handles the AJAX POST from the JS, validates the CSRF
      token, sanitises input, and saves preferences to #__users.params

Testing Instructions

  1. Install the plugin via System → Discover (click Discover, then install
    System – User Column Preferences)
  2. Enable the plugin in System → Plugins - User Column Preferences
  3. Go to any admin list view (e.g. Articles, Modules, Users)
  4. Use the Columns button to hide one or more columns — wait a moment for the
    AJAX call to complete
  5. Use the "Save" button to write the changes to the DB
  6. Open the same list view in a different browser or private/incognito tab and
    log in
  7. Verify the same columns are hidden

Actual result BEFORE applying this Pull Request

Column visibility is stored in localStorage only. Preferences are lost when
switching browsers, clearing cache, switching devices, or using a private tab.

Expected result AFTER applying this Pull Request

Expected result AFTER applying this Pull Request

Column visibility is persisted in the user account. Preferences are consistent
across all browsers and sessions for the same user account.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

Adds plg_system_usercolumns (system plugin) that stores each logged-in
user's hidden-column preferences in #__users.params (key: tablecolumns).
The table-columns.es6.js saveState() now POSTs to com_ajax on every
toggle (fire-and-forget), and loadState() reads server-injected state
first so preferences follow the user across browsers and sessions,
falling back to localStorage for guests and anonymous users.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@MacJoom MacJoom changed the title [6.1] Persist admin column visibility per user account across browsers [6.1] [AI] Persist admin column visibility per user account Mar 1, 2026
@MacJoom MacJoom changed the title [6.1] [AI] Persist admin column visibility per user account [6.1] [AI] Backend: Persist admin column visibility per user account for lists in backend Mar 1, 2026
@MacJoom MacJoom changed the title [6.1] [AI] Backend: Persist admin column visibility per user account for lists in backend [6.1] [AI] Backend: Save column visibility preferences per user account in list views Mar 1, 2026
MacJoom and others added 8 commits March 1, 2026 21:29
Guard the server-sync fetch in saveState() with a dedicatedtable.columns.sync flag injected by the plugin (admin context only), so the AJAX call never fires on the frontend even when a CSRF token is present. Also adds an explicit csrf.token empty-check as a secondary guard.
…to-dropdown

Add 'Keep settings' checkbox to table columns dropdown
@MacJoom MacJoom changed the title [6.1] [AI] Backend: Save column visibility preferences per user account in list views [6.2] [AI] Backend: Save column visibility preferences per user account in list views Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant