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 30 forks source link

Prevent access to profile.php, tools.php directly (via url) #51

Closed arma3marius closed 7 years ago

arma3marius commented 8 years ago

Version Information

Hello,

Can I use this plugin to prevent ordinary users from accessing for example wp-admin/profile.php and tools.php

I can disable the menu, but they can still type the URL directly.

I am currently using this workaround:

function disable_page() {

    if ( ! current_user_can('administrator') ) 
    {
        wp_die( 'Access denied.' ); 
    }

}
add_action( 'load-profile.php', 'disable_page' );
add_action( 'load-tools.php', 'disable_page' );
add_action( 'load-user-edit.php', 'disable_page' );

Thanks for this great plugin!

bueltge commented 8 years ago

Hey @pisces72 you have right. The plugin hide currently only, no check or todo to prevent the access. For a refactoring of the plugin is it a requirement in my list, but I found not enough time for this work. But maybe I include a simple solution, like your idea for each page slug of the admin pages.