Support

Search results for ""

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

Allow Editors to configure columns

Hi there,

we have a larger custom WP setup, where editors should be enabled to configure columns as well.
Right now only Users with Role “Admin” can do this.
I added the “manage_admin_columns” capability to the editor role, then the settings icons appears on their post list as well, but if you click on it you will get “You are not allowed to access this page”.

Is there any hook or additional capability that I can use to enable this?

thanks
-Elmar

5 years, 6 months ago
Stefan van den Dungen Gronovius
Developer

Hi Elmar,

Thanks for your feedback.
Granting an editor with the capability ‘manage_admin_columns’ should do the trick.
I tried this on my local environment and it seems to word correctly so I’m not sure why it does not work in your case. Did you use a specific plugin to manage the capabilities for roles?

5 years, 6 months ago
elmar

Hi Stefan,

I am sorry not updating this for a long time, the problem slipped away due to other priorities – but just popped up again last week :-)

I added the capability, then it fails with “Unable to to load codepress-admin-column”.
I digged through the complete stacktrace and found out that it needs the “manage_options” capability as well.

Ultimately this is not what I want for the editors, because they should not access the WP options settings.
This capability is enforced by wordpress, because the page is treated as an option page as well.

I can fake with css by hiding the menu for editors – but this is not a solid solution – of course.

Any idea?

Thanks
Elmar

5 years, 2 months ago
Tobias Schutter
Developer

Hi Elmar,

If you run this in your theme’s functions.php you should be good to go:

add_action( 'admin_init', function () {
	global $wp_roles;

	$wp_roles->add_cap( 'editor', 'manage_admin_columns' );
});

edit: changed \AC\Capabilities::MANAGE to manage_admin_columns in the code example

5 years, 2 months ago
elmar

Hi Tobias,

thanks for your reply. I see, that \AC\Capabilities::MANAGE is defined as “manage_admin_columns”.
If I add this capability, the user with this role will see the cog symbol for AC.
But if they click on it they will get the error described above, unless I also add the capability “manage_options”.

Now I want them to use AC, but I don’t want them to access the WP options ;-)

This is where I am looking for a smart solution.

Thanks
Elmar

5 years, 2 months ago
Stefan van den Dungen Gronovius
Developer

Elmar,

I tried to reproduce your situation but I do not need to give my role the capability ‘manage_option’ to access our settings page. I specifically removed the manage_option cap and it still works. So at this moment, I don’t have an idea why this does not work as expected on your environment.

5 years, 2 months ago
elmar

Hi Stefan,

good to hear it is basically that easy ;-)
I didn’t try in a blank installation, because it I need it to work exactly in this configuration.
For this use case I may hide the additional exposed options using css .. not the best way, but it will work here.

Thanks for you support!
-Elmar

5 years, 2 months ago
christian6

This worked perfectly, I used a plugin (Profile Builder Pro) to add the capability (no code required) and the custom role I defined was able to configure the columns – sweet! :-)

4 years, 5 months ago

You must be logged in to reply to this topic.