wp-media / adminimize

Adminimize is a WordPress plugin that lets you hide 'unnecessary' items from the WordPress backend.
https://wordpress.org/plugins/adminimize/
GNU General Public License v2.0
100 stars 31 forks source link

Wordpress 5.5 breaks functionality of custom options? #140

Closed jockebq closed 4 years ago

jockebq commented 4 years ago

Version Information

Steps to Reproduce

  1. Add "Your own options" to "Menu options"
    Posts               edit.php
    Comments      edit-comments.php
    Tools               tools.php
  2. Check the checkboxes for a user group.
  3. Login as a user part of that user group.
  4. It will not hide these!?

What I Expected

In WP 5.4 and all previous versions, this made all these custom options unavailable.

What Happened Instead

As of WP 5.5 this appears to do nothing?

Screenshot or Video

1111

bueltge commented 4 years ago

I tried that today with the current stable release of WP, version 5.5, and the last version of Adminimize 1.11.7 and it works as expected. I added custom options in the area ‘Menu’ and ‘Dashboard’. I added custom options, like

For the Menu settings: Name | value Posts | edit.php Comments | edit-comments.php Tools | tools.php image

For the Dashboard options: Name | value View | #dashboard_right_now image

After saving I see the checkboxes on each role and select them for different roles. After access with the login data in incognito mode of the browser it works, the area and the menu items are not visible.

Please would you try them without other plugin and a default theme, maybe there is any inconsistency.

bueltge commented 4 years ago

Gutenberg context.

I try them also for the 'Revisions' Area on a Gutenberg Edit Post screen. Please see image Settings for this area, CSS syntax because is a class. image

jockebq commented 4 years ago

@bueltge thank you for looking into it. I am not getting it to work. But I forgot to mention that this is used on a multisite network. Maybe it is only apparent on multisite? I have "Network activated" Adminimize, and on my "main" site I have the settings setup. And this always worked until WP 5.5. I tried deactivating and reactivating. But no success!

bueltge commented 4 years ago

I mean no, Adminimize is more a single settings plugin, get the options from one site in the network, and provide this settings in each site. So we talk bout custom options, is not necessary that it existent in each site. If the menu item is existent the plugin will hide them for the role. So in short, should also work.

jockebq commented 4 years ago

I mean no, Adminimize is more a single settings plugin, get the options from one site in the network, and provide this settings in each site. So we talk bout custom options, is not necessary that it existent in each site. If the menu item is existent the plugin will hide them for the role. So in short, should also work.

Yes, and that's the way I am using it. I setup Adminimize on one site, and all others follow. But right now I cannot use it for custom options. It works as expected on all other settings, I can hide for example Media (as that is not a custom option). But Posts I have to put in custom options, and that doesn't do anything. So something must have happened with Adminimize right?

jockebq commented 4 years ago

I also tried to Uninstall all database entries and readding them, still having the same issues.

jockebq commented 4 years ago

I noticed something weird, if I am logged in as a Super Admin I do not see the Comments, Tools and Posts menu items (I have not hidden them with Adminimize). But if I log in as any other role I have created I can see them?

bueltge commented 4 years ago

@jockebq Have you get my email? Maybe it is possible to look inside this environment for me?

jockebq commented 4 years ago

@bueltge I think I found the issue, which is weird because I have not changed this code. In my functions.php for my theme I got this code to hide the menu options for the Super Admin:

    if (current_user_can('update_core')) {
        add_action( 'admin_menu', 'admin_remove_menu_pages' );
    }
    function admin_remove_menu_pages() {
        remove_menu_page( 'link-manager.php' ); // Links
        remove_menu_page( 'edit-comments.php' ); // Comments
        remove_menu_page( 'edit.php' ); // Posts
        remove_menu_page( 'tools.php' ); // Tools
    }

And for the Super Admin it has been hidden, but it seems to have prohibited the hiding of these menu items for Adminimize user roles. So once I removed this code it seems to work.

bueltge commented 4 years ago

That's great for this issue, so I will close them. However, this is not coding for a theme and should be removed, maybe in a separate plugin, not inside code there has the job for a front-end.