Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics

Feature request – set column set with filter/hook


I would love to be able to set the active column set with a hook/filter. That way I can set it based on settings on a specific user instead of user role.

I can see that I can change the column labels and values with a filter – but with columns sets with many columns it would be easier to simply create different column sets and select the active one on load with a filter.

4 months, 3 weeks ago

If such a filter should exist, it always means that the drop-down to ‘choose’ between sets should become obsolete. Aside from that, we store that last visited column set a preference so the next time you visit the page would be the same as you left. With a hook to overwrite that, a user will never be able to change the column set.

To set a specific set per user, you could even create a set and set a specific user to that set (aside from role). If a user has only one column set, it should load that specific set.

Can you tell me a bit more about your use case and how you should see this work in combination with the options we have right now to set a column to a user?

4 months, 3 weeks ago


Sorry for the late reply! I forgot to select the notify option :-/

I have a site with WPML installed. Based on the current admin language, I would like to enable certain column sets for the user.

That way I can present data in the correct language to the user.

For example I could name the columns correctly in either danish or english (I have found a different solution for this using the filter “ac/headings/label”)

Also I could present different data depending on the active admin language. For example I have custom post types with ACF fields for dates and times in both danish and english. I would like to enable a column set that shows the ACF fields containing danish data and enable another column set with the english data.

I could create different user roles for the danish and english user and limit the column sets that way. But my users may want to change the admin language between danish and english. Giving them a user role would therefore limit them to only see either the danish or english data.

For example the user may want to export data in english for a colleague while they prefer the admin language to be danish.

I hope this makes sense :-)

3 months ago

Thanks for the explanation.
I do understand your use case, but there is still one thing why I believe this might not work.
If you programmatically set a column set based on any conditional, you will lock the ability to let the user choose which column set it wants to see. Or do you only want to set a default column set if a user has never visited a specific screen? Once the view is changed, your logic would not work anymore because then the user preference will always be loaded. I believe there is no way where you can force a set for a user but also make it possible to let them be able to switch.

The only option I do see now is that you set (force) the user preference yourself. The last visited preference is stored in the user meta table under the key: wp_ac_preferences_layout_table. This meta field contains an array with the stored column set ID for every screen. You could update this option to force a specific screen for a user/role based on your own custom conditionals.

2 months, 3 weeks ago

What if there was a filter to simply filter the list of column sets? That way I can edit the list based on user and the user can still change what column set or sets to select between.

I will look at setting the meta key :-)

2 months, 3 weeks ago

You must be logged in to reply to this topic.