• I have Googled for days… What is the correct way to set default screen options for contributors? I know how to check if they are contributors, but the screen options change based on what admin page you are on.

    Also, there are a lot of plugins that add columns to the post overview page. Is it possible to just say that I want only these columns to show, and hide the rest? And also hide the screen options.

    And do this in a way that new plugins or changes to old ones will not suddenly show columns I want to hide?

    I am going to have a lot of registered contributors that are new to the system. I want to make it as simple and consistent for everyone as possible.

    All contributors should always see the exact same things, and I need to be in control of what that is.

    As a new contributor you now have one letter per line in the post title column because there are so many columns fighting for space that are enabled by default.

    • This topic was modified 4 years, 5 months ago by Jan Dembowski.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator bcworkz

    (@bcworkz)

    Generally speaking, it’s often difficult to manage the back end HTML output. If you can hide undesired elements through CSS, then conditionally enqueuing that CSS file when the current user has a certain role would be a feasible solution. Someone who is web savvy could still view the hidden information if they wanted to, so this is not a good way to hide sensitive information. But at least to start with, the users will see what you intend them to see.

    You’d hook “admin_enqueue_scripts” action and call wp_enqueue_script() to get your CSS file loaded. Try to get your CSS loaded last so it has the final say in styling. If you can learn the handle of the CSS file currently loaded last and enqueue with a dependency parameter of that handle, your file would load last.

    Thread Starter Dekadinious

    (@dekadinious)

    Yes, the thought has crossed my mind. But I am not really a fan of it… Some of the plugins are not that smart and are loading sensitive information to contributors too. That is something that the plugin author needs to fix though.

    I was hoping there was some kind of for/each I could run for each outputted admin column and say if it does NOT match my criteria, just don’t show it.

    But I am guessing it’s not?

    CSS will have to do in the mean time.

    Moderator bcworkz

    (@bcworkz)

    What’s possible depends on the individual plugins. Since they likely use WP hooks themselves to accomplish what they do, you may be able remove or override their hooks after they’ve been added to nullify what they normally do. You’d need to find each hook involved and use a similar technique to change what happens with that hook.

    Thread Starter Dekadinious

    (@dekadinious)

    Yes, I see. I just nuked everything with CSS and will just cross my fingers ??

    I found this tutorial while searching for an unrelated trouble, hope it helps you

    https://wp-mix.com/wordpress-remove-screen-options/

    No solution for this?

    How to set default screen options for editors and administrators?

    Also, a lot of plugin add their own screen option, and they set as checked by default.

    I found this, but not sure what they are talking about:
    https://wordpress.stackexchange.com/questions/15376/how-to-set-default-screen-options

    Hi,

    @dekadinious and @bcworkz One another handy and reliable solution is that, you enqueue js script file into admin instead of css and remove the unnecessary columns using jQuery remove() function.

    This way, they can’t reveal the hidden column.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Set default columns and screen options for user role?’ is closed to new replies.